在Ubuntu安装kubernetes1.22.2时遇到的问题

kubernetes问题:[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp 127.0.0.1:10248: connect: connection refused.

查看状态

systemctl status kubelet

会发现是exit 异常退出,查看日志

journalctl -xeu kubelet

发现如下错误

Failed to run kubelet" err="failed to run Kubelet: misconfiguration: kubelet cgroup driver: \"systemd\" is different from docker cgroup driver: \"cgroupfs\"

这是cgroup的驱动不匹配导致的,本地docker使用的是cgroupfs,然而kubelet使用的是systemd

确认当前使用的驱动版本:

docker info |grep -i cgroup
WARNING: No swap limit support
 Cgroup Driver: cgroupfs
 Cgroup Version: 1

修改:

vim /etc/docker/daemon.json
{"exec-opts": ["native.cgroupdriver=systemd"]}

重启,搞定

systemctl restart docker
发表回复 0

Your email address will not be published. Required fields are marked *