win10环境,安装的VMware Workstation Pro,创建了一台Centos7.x的虚拟机。并启用虚拟化。
截图20191015175316721.jpg

先安装kubectl

// v1.16.0版本可以从这里查 https://storage.googleapis.com/kubernetes-release/release/stable.txt
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version

上述如果在墙内,需要http代理可以,先将代理设为环境变量 export http_proxy=http://ip:port

也可以从github上下载
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG.md#client-binaries-1
找到Current release如 https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.16.md
再找到Client Binaries如v1.16.0下的 https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.16.md#client-binaries
再找到合适的tar包如 https://dl.k8s.io/v1.16.0/kubernetes-client-linux-amd64.tar.gz

wget https://dl.k8s.io/v1.16.0/kubernetes-client-linux-amd64.tar.gz
tar -zxvf kubernetes-client-linux-amd64.tar.gz
cd kubernetes/client/bin
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version

下载minikube

版本可以从这里查https://github.com/AliyunContainerService/minikube

curl -Lo minikube http://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.4.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

也可以自己构建:

git clone https://github.com/AliyunContainerService/minikube
cd minikube
git checkout aliyun-v1.4.0
make
sudo cp out/minikube /usr/local/bin/

安装docker

yum install -y docker
systemctl enable docker
systemctl start docker

修改docker的cgroup driver为cgroupfs

重要!!!
因为默认安装的docker driver为systemd, 在执行minikube start时会报这种错

failed to create kubelet: misconfiguration: kubelet cgroup driver: "cgroupfs" is different from docker cgroup driver: "systemd"

可以用docker info|grep -i driver查看默认的driver是不是systemd

修改docker.service
vi /lib/systemd/system/docker.service
找到
native.cgroupdriver=systemd
修改为:
--exec-opt native.cgroupdriver=cgroupfs

并重启docker

systemctl daemon-reload
systemctl restart docker

启动minikube

minikube start --vm-driver=none --image-mirror-country=cn;

//或者
minikube start --vm-driver=none --registry-mirror=https://docker.mirrors.ustc.edu.cn

问题定位方法

看minikube和kubelet的日志

minikube logs
journalctl -xu kubelet

标签: centos, k8s, minikube

相关文章

添加新评论