问题如下:
Unfortunately, an error has occurred:
timed out waiting for the condition
This error is likely caused by:
- The kubelet is not running
- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
- 'systemctl status kubelet'
- 'journalctl -xeu kubelet'
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.
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 cluster
To see the stack trace of this error execute with --v=5 or higher
查日志发现:
master kubelet[35712]: E0321 17:14:23.075875 35712 kubelet.go:2183] node "master" not found
解决方案:
第一步:查看docker服务起来了吗?
第二步:查看yaml文件中,IP写对了吗?要写成本机的啊!!
查来查去,发现是init-config.yaml中
advertiseAddress: 192.168.206.133 #master节点IP
IP写错了!!真是坑啊!
这里要写本机的IP,不要复制过来或者写成别的了!
以上步骤查完了,还是这个问题?
第三步:杀掉整个部署进程,重来一次!
hostnamectl set-hostname master
cat clean.sh
for port in 6443 10259 10257 10250 2380 2379
do
lsof -i:$port |awk '{print $2}' | grep -v PID | xargs kill -9
done
rm -rf /etc/kubernetes/manifests/kube-apiserver.yaml /etc/kubernetes/manifests/kube-controller-manager.yaml /etc/kubernetes/manifests/kube-scheduler.yaml /etc/kubernetes/manifests/etcd.yaml /var/lib/etcd/*
sh clean.sh
swapoff -a && kubeadm reset && systemctl daemon-reload && systemctl restart kubelet && iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X
再来一次!
见了这个信息,表示一定可以成功的!
总之:一定是某个进程没起来,或者是配置文件出错了。
如果是kubeadm安装的集群,详细步骤请看:
centos7.9 kubeadm 安装kubernetes集群(无坑)_centos7.9 安装kubenates-CSDN博客
只要按照这个一步步来,百分百成功!