Kubernetes报错Failed to get system container stats for "/system.slice/kubelet.service"

k8s版本1.10.1

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

Failed to get system container stats for “/system.slice/kubelet.service”: failed to get cgroup
stats for “/system.slice/kubelet.service”: failed to get container info for “/system.slice/kubelet.service”: unknown container “/system.slice/kubelet.service”

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

解决方法:修改kubelet配置文件
1,vim /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
2,找到 KUBELET_CGROUP_ARGS=–cgroup-driver=systemd 在后面增加以下内容:
–runtime-cgroups=/systemd/system.slice –kubelet-cgroups=/systemd/system.slice
Environment=”KUBELET_CGROUP_ARGS=–cgroup-driver=systemd –runtime-cgroups=/systemd/system.slice –kubelet-cgroups=/systemd/system.slice”

保存之后,重启kubelet服务即可
systemctl daemon-reload
systemctl restart kubelet

你可能感兴趣的:(Kubernetes报错Failed to get system container stats for "/system.slice/kubelet.service")