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版本兼容性问题
解决方法:修改kubelet配置文件
vim /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
找到 KUBELET_CGROUP_ARGS=–cgroup-driver=systemd 在后面增加以下内容:
–runtime-cgroups=/systemd/system.slice –kubelet-cgroups=/systemd/system.slice
Environment="KUBELET_CGROUP_ARGS=--runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice" 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