kubelet failed to get container info for "/system.slice/docker.service": unknown container "/system.slice/docker.service"错误

kubernetes版本1.18.6

描述:在查看kubelet状态或是在查看日志时有以下错误

Jun 28 14:05:08 cwztapp131 kubelet[775]: E0628 14:05:08.185793     775 summary_sys_containers.go:47] Failed to get system container stats for "/system.slice/docker.service": failed to get cgroup stats for "/system.slice/docker.service": failed to get container info for "/system.slice/docker.service": unknown container "/system.slice/docker.service"

原因:kubernetes和docker版本兼容性问题

注意:本文以centos7操作系统为例,不同操作系统kubelet配置文件路径可能不一致。

解决方法:
修改kubelet配置文件,在/etc/systemd/system/kubelet.service.d/10-kubeadm.conf文件中增加环境配置:

Environment="KUBELET_CGROUP_ARGS=--runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice"

并在启动命令尾部添加变量 $KUBELET_CGROUP_ARGS如下:

ExecStart=/usr/local/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_CGROUP_ARGS $KUBELET_EXTRA_ARGS

保存之后,重启kubelet服务即可 

systemctl daemon-reload
systemctl restart kubelet

参考:https://blog.csdn.net/vicsun2007/article/details/82289211

posted @ 2021-07-20 11:38  人艰不拆_zmc  阅读(1982)  评论(0编辑  收藏  举报