Additionally, a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI, e.g. docker.
Here is one example how you may list all Kubernetes containers running in docker:
- ‘docker ps -a | grep kube | grep -v pause’
Once you have found the failing container, you can inspect its logs with:
- ‘docker logs CONTAINERID’
error execution phase wait-control-plane: couldn’t initialize a Kubernetes clusterrunning command: sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --ignore-preflight-errors=DirAvailable–etc-kubernetes-manifests,DirAvailable–data-minikube,FileAvailable–etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable–etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable–etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable–etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap
.: exit status 1
- Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
- https://github.com/kubernetes/minikube/issues/new
看上面的问题像是kubelet启动失败了,执行命令tail /var/log/messages查看进一步的原因:
Jun 8 09:45:35 minikube kubelet: F0608 09:45:35.392302 24268 server.go:266] failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: “cgroupfs” is different from docker cgroup driver: “systemd”
Jun 8 09:45:35 minikube systemd: kubelet.service: main process exited, code=exited, status=255/n/a
Jun 8 09:45:35 minikube systemd: Unit kubelet.service entered failed state.
Jun 8 09:45:35 minikube systemd: kubelet.service failed.
上述日志表明:kubelet的cgroup driver是cgroupfs,docker的 cgroup driver是systemd,两者不一致导致kubelet启动失败。
解决问题
- 尝试过修改kubelet的cgroup dirver(文件位置:/etc/systemd/system/kubelet.service.d/10-kubeadm.conf),但是每次启动minikube时会被覆盖掉,于是只能放弃这种处理方式,转去修改docker的cgroup dirver设置;
- 打开文件/usr/lib/systemd/system/docker.service,如下图,将红框中的systemd改为cgroupfs:
- 重新加载配置信息,重启服务:
systemctl daemon-reload && systemctl restart docker
完成了上述修改,再去重新启动minikube就可以成功了,如下:
[root@minikube ~]# minikube delete
- Uninstalling Kubernetes v1.14.3 using kubeadm …
- Deleting “minikube” from none …
- The “minikube” cluster has been deleted.
[root@minikube ~]# minikube start --vm-driver=none
- minikube v1.1.1 on linux (amd64)
- Creating none VM (CPUs=2, Memory=2048MB, Disk=20000MB) …
- Configuring environment for Kubernetes v1.14.3 on Docker 1.13.1
- Unable to load cached images: loading cached images: loading image /root/.minikube/cache/images/gcr.io/k8s-minikube/storage-provisioner_v1.8.1: stat /root/.minikube/cache/images/gcr.io/k8s-minikube/storage-provisioner_v1.8.1: no such file or directory
- Pulling images …
- Launching Kubernetes …
- Configuring local host environment …
! The ‘none’ driver provides limited isolation and may reduce system security and reliability.
! For more information, see:
! kubectl and minikube configuration will be stored in /root
! To use kubectl or minikube commands as your own user, you may
! need to relocate them. For example, to overwrite your own settings:
- sudo mv /root/.kube /root/.minikube $HOME
- sudo chown -R USERUSER HOME/.kube $HOME/.minikube
- This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
最后的话
最近很多小伙伴找我要Linux学习资料,于是我翻箱倒柜,整理了一些优质资源,涵盖视频、电子书、PPT等共享给大家!
资料预览
给大家整理的视频资料:
给大家整理的电子书资料: