国内使用minikube安装k8s

docker: 19.03.4
minikube: 1.5.2
kubernetes: 1.16.2
kubectl: 1.16.2

一、安装docker环境

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum -y install docker-ce

mkdir -p /etc/docker
touch /etc/docker/daemon.json
cat >> /etc/docker/daemon.json <<EOF
{
  "registry-mirrors": ["https://7bezldxe.mirror.aliyuncs.com", "https://kw88y6eh.mirror.aliyuncs.com"]
}
EOF

systemctl daemon-reload && systemctl restart docker

二、下载minikube

wget -c https://github.com/kubernetes/minikube/releases/download/v1.5.2/minikube-1.5.2.rpm
rpm -ivh minikube-1.5.2.rpm

三、启动k8s

这里直接使用主机的docker环境安装k8s,不使用虚拟机方式。如果失败,就多试几次就可以了

minikube delete;
minikube start --vm-driver=none \
    --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers \
    --kubernetes-version='v1.16.2'

四、下载kubectl

wget -c https://rpmfind.net/linux/opensuse/tumbleweed/repo/oss/x86_64/kubectl-1.16.2-2.2.x86_64.rpm
rpm -ivh kubectl-1.16.2-2.2.x86_64.rpm

五、查看集群状态

# kubectl get nodes
NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    master   28m   v1.16.2

注:腾讯云国内CVM安装成功

推荐阅读更多精彩内容