概述
K8S集群启动报错 kubelet cgroup driver: “cgroupfs” is different from docker cgroup driver: “systemd”
master节点初始化的时候,docker配置如下,忘了设置cgroup driver: “systemd
vim /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=cgroupfs"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
],
"registry-mirrors": ["https://pf5f57i3.mirror.aliyuncs.com"]
}
k8s 主节点安装k8s,有错误提示但是启动了,其他主节点和node节点加入也正常,看到整个集群都Ready,回去在修改主节点的 /etc/docker/daemon.json,native.cgroupdriver=systemd,改完重启kubelet后,发现3个主节点都起不来了。
journalctl -f -u kubelet 查看日志发现,报错如下:
kubelet cgroup driver: “cgroupfs” is different from docker cgroup driver: “systemd”
这个里要修改3个配置文件为systemd
1.vim /etc/docker/daemon.json
“exec-opts”: [“native.cgroupdriver=systemd”]
2.vim /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
在KUBELET_KUBECONFIG_ARGS 后面追加 --cgroup-driver=systemd
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --cgroup-driver=systemd"
3.vim /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--cgroup-driver=systemd --network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.2"
然后重启kubelet:
systemctl daemon-reload
systemctl restart kubelet
k8s集群就恢复了。
最后
以上就是高贵唇彩为你收集整理的K8S集群启动报错kubelet cgroup driver: “cgroupfs“ is different from docker cgroup driver: “systemd“的全部内容,希望文章能够帮你解决K8S集群启动报错kubelet cgroup driver: “cgroupfs“ is different from docker cgroup driver: “systemd“所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复