我尝试将我的 kubeadm 集群与 Three master 堆叠在一起。我从我的 init 命令收到这个问题...
[kubelet-check] Initial timeout of 40s passed.
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, 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 cluster
但我不使用 cgroupfs,而是使用 systemd 我的 kubelet 抱怨不知道他的节点名。
Jan 23 14:54:12 master01 kubelet[5620]: E0123 14:54:12.251885 5620 kubelet.go:2266] node "master01" not found
Jan 23 14:54:12 master01 kubelet[5620]: E0123 14:54:12.352932 5620 kubelet.go:2266] node "master01" not found
Jan 23 14:54:12 master01 kubelet[5620]: E0123 14:54:12.453895 5620 kubelet.go:2266] node "master01" not found
请告诉我问题出在哪里。
如果问题与 Docker 无关,可能是因为 Kubelet 服务无法与 API 服务器建立连接。
我首先会检查 Kubelet 的状态:
systemctl status kubelet
,并考虑使用 systemctl restart kubelet
重新启动。
如果这没有帮助,请尝试重新安装 kubeadm 或使用其他版本运行
kubeadm init
(使用 --kubernetes-version=X.Y.Z
标志)。
就我而言,我的 k8s 版本是 1.21.1,我的 docker 版本是 19.03。我通过将 docker 升级到 20.7 版本解决了这个错误。
如果您使用 haproxy 设置,请在路径 /etc/haproxy/haproxy.cfg 中的配置文件中配置端口 6443,下面是以下设置
frontend kubernetes
bind 10.182.0.2:6443
option tcplog
mode tcp
default_backend kubernetes-master-nodes
backend kubernetes-master-nodes
mode tcp
balance roundrobin
option tcp-check
server kubernetes-master-1 10.182.0.7:6443 check fall 3 rise 2
server kubernetes-master-2 10.182.0.8:6443 check fall 3 rise 2