Docker cgroup driver configuration¶
Configuring the Docker cgroup driver is a critical step in setting up a Kubernetes cluster to ensure the container runtime and the kubelet operate with the same [[control group]] (cgroup) driver.^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md]
Configuration¶
To configure Docker to use the systemd cgroup driver, create or modify the /etc/docker/daemon.json file.^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md]
{
"exec-opts": ["native.cgroupdriver=systemd"]
}
After creating the configuration file, restart the Docker service for the changes to take effect^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md].
sudo systemctl restart docker
Troubleshooting¶
A mismatch between the Kubernetes cgroup driver (defaulting to systemd) and the Docker driver can result in the kubelet failing to start or becoming unhealthy.^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md] This may be indicated by error logs such as The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md]
Sources¶
^[400-devops-06-kubernetes-k8s-learning-00install-01-kubernetes.md]