How to fix “The kubelet is unhealthy due to a misconfiguration of the node in some way required cgroups disabled error

Issue

The kubelet is unhealthy due to a misconfiguration of the node in some way required cgroups disabled error is observed while installation of Kubernetes cluster.

[kubelet-check] Initial timeout of 40s passed.

Unfortunately, an error has occurred:
        timed out waiting for the condition

This error is likely caused by:
        - The kubelet is not running
        - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)

If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
        - 'systemctl status kubelet'
        - 'journalctl -xeu kubelet'

Additionally, a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI, e.g. docker.
Here is one example how you may list all Kubernetes containers running in docker:
        - 'docker ps -a | grep kube | grep -v pause'
        Once you have found the failing container, you can inspect its logs with:
        - 'docker logs CONTAINERID'
error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster

Fix: The kubelet is unhealthy due to a misconfiguration of the node in some way required cgroups disabled

Create /etc/docker/daemon.json file and add below configuration.

[root@master1]#cat > /etc/docker/daemon.json <<EOF
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2",
  "storage-opts": [
    "overlay2.override_kernel_check=true"
  ]
}
EOF

mkdir -p /etc/systemd/system/docker.service.d

systemctl daemon-reload
systemctl restart docker

Still I was getting error which was resolved by creating docker.conf with below content

[root@master1]#vim /etc/systemd/system/docker.service.d/docker.conf 
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd

Reload deamon and restart docker

systemctl daemon-reload
systemctl restart docker

Reference: https://docs.docker.com/config/daemon/

After that every thing was fine and i was able to setup the Kubernetes cluster.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments