k8s 启动时的时候如有相关提示,指明kubelet和docker的Cgroup 驱动不一致:
有两种方式解决问题,一种是
- 修改docker:
vim /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"]
}
重启docker
systemctl daemon-reload
systemctl restart docker
- 修改kubelet
vim /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
网友评论