当前位置: 首页 > 工具软件 > ControlPlane > 使用案例 >

历尽艰辛的问题:Waiting for the kubelet to boot up the control plane......This can take up to 4m0s

田永春
2023-12-01

只是初始化一个集群,没想到如此艰辛。
初始化集群使用如下命令:
sudo kubeadm init --kubernetes-version=v1.26.1 --ignore-preflight-errors=all
结果出现如题所示问题:
waiting for the kubelet to boot up the control plane as Static Pods from directory “/etc/kubernetes/manifests”
this might take a minute or longer if the control plane images have to be pulled
Unfortunately, an error has occurred:
timed out waiting for the condition

结合日志中的内容journalctl -xeu kubelet,搜索各种可能出现的问题,如下:

  1. The kubelet is not running:这个问题确认不存在, 查看kubelet的状态是running.
  2. The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled): 这个可能性不能确认,但是关于cgroup的配置已经检查过几遍,应该也没有问题.
  3. 日志中skipping pod synchronization:这个信息也没有搜索到什么结果。
  4. Failed to read checkpoint for “kubelet_internal_checkpoint”:这个信息也没有找到问题的原因。
  5. container runtime status check may not have complete PLEG is not healthy: 没有找到原因。

在自己的努力坚持下,终于看到这条内容:this might take a minute or longer if the control plane images have to be pulled #1023(https://github.com/kubernetes/kubeadm/issues/1023), 尝试一下,没想到竟然成功了!方法就是修改/lib/systemd/system/kubelet.service,添加kubelet启动参数如下:
[Service]
ExecStart=/usr/bin/kubelet --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml

然后,重启计算机,执行sudo kubeadm reset 后重新执行sudo kubeadm init,成功进行了初始化:
[apiclient] All control plane components are healthy after 13.501844 seconds
[upload-config] Storing the configuration used in ConfigMap “kubeadm-config” in the “kube-system” Namespace
[kubelet] Creating a ConfigMap “kubelet-config” in namespace kube-system with the configuration for the kubelets in the cluster

现在回想起来,真是一把辛酸泪,还真是最开始提示的问题:“The kubelet is unhealthy due to a misconfiguration ”,但是谁要能想到是什么问题呢?

 类似资料: