kubectl service fails to start

1、报错:
error: failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: "cgroupfs" is different from docker cgroup driver: "systemd

2. Reason: The
kubelet file drives the default cgroupfs, and the file driver used by our installed docker is systemd, which causes inconsistency and causes the image to fail to start.

3. Processing:
There are two ways now, one is to modify docker, and the other is to modify kubelet.

Most of the Internet said to modify daemon.josn

#修改daemon.json
vi /etc/docker/daemon.json
#添加如下属性
"exec-opts": [
    "native.cgroupdriver=systemd"

]

This will cause the docker to fail to start successfully after the modification, prompting that daemon.json and native.cgroupdriver = systemd in /lib/systemd/system/docker.service overlap.

4. Operation modification docker.service

(1)修改前查看docker Cgroup Driver
shell> docker info | grep Driver
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Storage Driver: overlay2
Logging Driver: json-file
Cgroup Driver: systemd
...
(2)修改docker.service
shell> vi /lib/systemd/system/docker.service

Find
--exec-opt native.cgroupdriver = systemd and
change to:
--exec-opt native.cgroupdriver = cgroupfs

(3)重启docker
shell> systemctl daemon-reload
shell> systemctl restart docker

(4) 重启 birth
shell> systemctl restart birth

(5) Check the k8s cluster, whether the node is normal
shell> kubectl get node
NAME STATUS ROLES AGE VERSION
node140 Ready master 126d v1.17.0

Guess you like

Origin blog.51cto.com/7603402/2487687