搭建单机k8s环境
Posted dadaizi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了搭建单机k8s环境相关的知识,希望对你有一定的参考价值。
安装minikube
1、本地下载kubectl
1
# 1 配置k8s的yum ,将kubernetes.repo添加到/etc/yum.repos.d中
2
3
[kubernetes]
4
name=Kubernetes
5
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
6
enabled=1
7
gpgcheck=1
8
repo_gpgcheck=1
9
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
10
11
# 2 安装kubectl
12
yum clean all
13
yum makecache
14
yum install -y kubectl
15
2、本地下载阿里的minikube
1
curl -Lo minikube http://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.2.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
2
3、安装非最新版的docker-ce
1
yum install -y yum-utils device-mapper-persistent-data lvm2
2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3
yum list docker-ce --showduplicates | sort -r
4
yum install docker-ce-17.12.0.ce
4、启动minikube
1
minikube start --vm-driver=none --registry-mirror=https://registry.docker-cn.com
2
1
[root@alluer ~]# minikube start --vm-driver=none --registry-mirror=https://registry.docker-cn.com * minikube v1.2.0 on linux (amd64)
2
* using image repository registry.cn-hangzhou.aliyuncs.com/google_containers
3
* Creating none VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
4
* Configuring environment for Kubernetes v1.15.0 on Docker 17.12.0-ce
5
* Downloading kubeadm v1.15.0
6
* Downloading kubelet v1.15.0
7
* Pulling images ...
8
* Launching Kubernetes ...
9
* Configuring local host environment ...
10
11
! The ‘none‘ driver provides limited isolation and may reduce system security and reliability.
12
! For more information, see:
13
- https://github.com/kubernetes/minikube/blob/master/docs/vmdriver-none.md
14
15
! kubectl and minikube configuration will be stored in /root
16
! To use kubectl or minikube commands as your own user, you may
17
! need to relocate them. For example, to overwrite your own settings:
18
19
- sudo mv /root/.kube /root/.minikube $HOME
20
- sudo chown -R $USER $HOME/.kube $HOME/.minikube
21
22
* This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
23
* Verifying: apiserver proxy etcd scheduler controller dns
24
* Done! kubectl is now configured to use "minikube"
25
以上是关于搭建单机k8s环境的主要内容,如果未能解决你的问题,请参考以下文章