kubelet cgroup driver: "cgroupfs" is different from docker cgroup driver: "systemd"
故障表现
在安装kubernetes的过程中,会出现
failed to create kubelet: misconfiguration: kubelet cgroup driver: "cgroupfs" is different from docker cgroup driver: "systemd"
原因是
docker 默认 cgroup driver 是 cgroup
kubelet 默认 cgroup driver 是 systemd
docker info查看
Cgroup Driver: systemd
解决
现在有两种方式, 一种是修改docker, 另一种是修改kubelet,
方法一:修改docker:
# 修改或创建 /etc/docker/daemon.json,加入下面的内容: { "exec-opts": ["native.cgroupdriver=systemd"] } # 重启docker: systemctl restart docker && systemctl status docker # 查看生效 docker info Cgroup Driver: systemd
方法二:修改kubelet:
修改 /etc/systemd/system/kubelet.service.d/10-kubeadm.conf 文件,增加 --cgroup-driver=cgroupfs
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --cgroup-driver=cgroupfs"
重启kubelet
# systemctl daemon-reload && systemctl restart kubelet
查看生效
# systemctl status kubelet | cat CGroup: /system.slice/kubelet.service └─13665 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --cgroup-driver=systemd --network-plugin=cni --pod-infra-container-image=registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.1
0顶
0 踩
共 0 条评论