kubernetes: 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"
Environement:- centos 7.4.1708 kubeadm v1.8.4
/kind bug What happened: all working fine. but when I check I getting first error https://github.com/moby/moby/issues/30628 So I have upgraded and got resolved. But again I get a new error as I mention the Subject issue. Don’t know why its showing issue or its known issue in kubelet. Just let me know if you have any solution. Below are logs which are continuously generating every 10 seconds.
Dec 5 12:42:03 kubelet: E1205 12:42:03.527763 23059 summary.go:92] 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” Dec 5 12:42:03 kubelet: E1205 12:42:03.527796 23059 summary.go:92] 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” Dec 5 12:42:03 kubelet: W1205 12:42:03.527852 23059 helpers.go:847] eviction manager: no observation found for eviction signal allocatableNodeFs.available
I have referred below URLs:- https://github.com/moby/moby/issues/30628 https://github.com/kubernetes/kubernetes/issues/55649 What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
- Kubernetes version (use
kubectl version
): Client Version: version.Info{Major:“1”, Minor:“8”, GitVersion:“v1.8.4”, GitCommit:“9befc2b8928a9426501d3bf62f72849d5cbcd5a3”, GitTreeState:“clean”, BuildDate:“2017-11-20T05:28:34Z”, GoVersion:“go1.8.3”, Compiler:“gc”, Platform:“linux/amd64”} Server Version: version.Info{Major:“1”, Minor:“8”, GitVersion:“v1.8.4”, GitCommit:“9befc2b8928a9426501d3bf62f72849d5cbcd5a3”, GitTreeState:“clean”, BuildDate:“2017-11-20T05:17:43Z”, GoVersion:“go1.8.3”, Compiler:“gc”, Platform:“linux/amd64”} - OS (e.g. from /etc/os-release): CentOS Linux release 7.4.1708 (Core)
- Kernel (e.g.
uname -a
): Linux 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 18
- Comments: 37 (4 by maintainers)
Links to this issue
Commits related to this issue
- nixos/kubernetes: fix kubelet cgroup stats https://github.com/kubernetes/kubernetes/issues/56850 — committed to NixOS/nixpkgs by eonpatapon 6 years ago
- nixos/kubernetes: fix kubelet cgroup stats https://github.com/kubernetes/kubernetes/issues/56850 (cherry picked from commit 76c7cc0f30d6b0bcd690e2d22b180e8b171ce544) — committed to NixOS/nixpkgs by eonpatapon 6 years ago
- Enable `CPUAccounting` and `MemoryAccounting` for kubelet.service. This causes systemd to create the missing `/system.slice/*.service` cgroups for all services. This allows the kubelet `/stats/summar... — committed to nikhita/machine-controller by nikhita 5 years ago
- Enable `CPUAccounting` and `MemoryAccounting` for kubelet.service (#476) * Enable `CPUAccounting` and `MemoryAccounting` for kubelet.service. This causes systemd to create the missing `/system.slice... — committed to kubermatic/machine-controller by nikhita 5 years ago
Also on AWS default image for kops (k8s-1.8-debian-jessie-amd64-hvm-ebs-2017-12-02 (ami-bd229ec4))
add at the end of DAEMON_ARGS string:
finally:
adding a file in : /etc/systemd/system/kubelet.service.d/11-cgroups.conf
with: [Service] CPUAccounting=true MemoryAccounting=true
and: systemctl daemon-reload systemctl restart kubelet
solve the issue for me .
Adding
/etc/systemd/system/kubelet.service.d/12-after-docker.conf
with the content below seems to help:Do
systemctl daemon-reload && systemctl restart kubelet
after adding this file.I’ve got the same errors on
And the above fix works for me. On CentOS I can add these options in
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
:Should we have this fix added to the kubeadm RPM by default?
Environment:
/kind bug
If run kubelet with “–docker-only” parameter,this problem will happen,just remove this paramter from your config file. It seems that kubelet will query cgroup info by cadvisor client,if you set “–docker-only”, cadvisor will not collect kubelet’s and runtime’s cgroups,so query will fail.
I have record this process but in Chinese:Kubernetes问题调查:failed to get cgroup stats for /systemd/system.slice .
by the way,i think --runtime-cgroups and --kubelet-cgroups should be set like this if you want:
–kubelet-cgroups=/system.slice/kubelet.service –runtime-cgroups=/system.slice/docker.service
Their values depend on your enviroment, the above setting example is for CentOS 7, kubelet and docker are managed by systemd.
I wonder if specifying the particular cgroup (as noted in https://github.com/kubernetes/kubernetes/issues/53960 ). Please see if the corresponding stackoverflow link ( https://stackoverflow.com/questions/46726216/kubelet-fails-to-get-cgroup-stats-for-docker-and-kubelet-services) fixes things?
@rdxmb the kubelet logs show
--cgroup-driver has been deprecated, --kubelet-cgroups has been deprecated
, but we also have to add the args to kubelet. My environment:My solution is:
echo 'KUBELET_EXTRA_ARGS=--runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice' > /etc/sysconfig/kubelet
Why is this issue closed? This problem still occurs with kubernetes v1.16.2 (in my case with Ubuntu 16.04) and the workarounds with the systemd-includes above must be set by the user manually. Can somebody please reopen this? Is there a way to get these things to the apt-packages?
I’ve got the same errors on
use
in kubelet config still can’t solve.
This remains not fixed and it seems every distribution is patching around it. The fix needs to be added to the kubelet RPM as described at #56850 (comment)
/reopen
I solved this problem like this:
Edit
/usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
and add two lines belowThe whole config file:
Then this message gone.
No it doesn’t fix things, or no you don’t want to check.