1、问题
kubeadm init初始化kubesphere集群的时候遇到如下错误:
- 1)错误1:
W0613 15:49:11.550029 2140 images.go:80] could not find officially supported version of etcd for Kubernetes v1.27.2, falling back to the nearest etcd version (3.5.7-0)
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[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.
Here is one example how you may list all running Kubernetes containers by using crictl:
- 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock ps -a | grep kube | grep -v pause'
Once you have found the failing container, you can inspect its logs with:
- 'crictl --runtime-endpoint unix:///var/run/containerd/containerd.sock 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
- 2)错误2:kubelet 服务无法启动报 code=exited, status=1/FAILURE错误
2、解决方法
- 1)即docker的驱动与kubelet 驱动不一致
(1)查看docker驱动
root@rancher-master:~# docker info | grep Cgroup
Cgroup Driver: cgroupfs
Cgroup Version: 1
WARNING: No swap limit support
(2) 查看kubelet驱动
root@rancher-master:~# cat /var/lib/kubelet/config.yaml | grep cgroup
cgroupDriver: systemd
(3) 修改docker驱动,查看/etc/docker/daemon.json文件,没有的话,手动创建,添加以下内容
{
"exec-opts": ["native.cgroupdriver=systemd"]
}
(4)
systemctl daemon-reload
systemctl restart docker
- 2)/etc/systemd/system/kubelet.service.d下是否有10-kubeadm.conf.如果没有需要创建这个文件,并复制如下内容。
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --fail-swap-on=false"
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort.
EnvironmentFile=-/etc/default/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
标签:docker,etc,--,ARGS,kubelet,init,报错,kubeadm,KUBELET From: https://www.cnblogs.com/zhangzl419/p/17997252