Failed to get kubelets cgroup

8/12/2019

Am trying to setup kubernetes in centos machine, kubelets start is giving me this error.

Failed to get kubelets cgroup: cpu and memory cgroup hierarchy not unified. Cpu:/, memory: /system.slice/kubelet.service.

The cgroup driver I mentioned is systemd for both docker and kubernetes

Docker version 1.13.1 Kubernetes version 1.15.2

Can any one suggest the solution.

-- sasi
docker
kubernetes

1 Answer

8/12/2019

This issue is fixed in a commit but still not merged see this

you may try this work around:

sudo vim /etc/sysconfig/kubelet

add at the end of DAEMON_ARGS string:

 --runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice

restart:

sudo systemctl restart kubelet

or :

adding a file in : /etc/systemd/system/kubelet.service.d/11-cgroups.conf

which contains:

[Service]
CPUAccounting=true
MemoryAccounting=true

then reload and restart

systemctl daemon-reload && systemctl restart kubelet
-- LinPy
Source: StackOverflow