查看状态
sudo systemctl status kubelet
会发现是exit 异常退出,查看日志
journalctl -u 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
修改:
sudo vim /etc/docker/daemon.json
添加
{"exec-opts": ["native.cgroupdriver=systemd"]}
重启,搞定
sudo systemctl restart docker