Unable to find CGroups details in 10-kubeadm.conf file

6/28/2018

I was trying to setup a Kubernetes cluster based on the documentation. https://kubernetes.io/docs/tasks/tools/install-kubeadm/

I install kubeadm by running:

 yum install -y kubeadm

I was about to update the 10-kubeadm.conf file as mentioned in the doc. But the file looks completely different, it was like this https://github.com/kubernetes/kubernetes/blob/master/build/rpms/10-kubeadm.conf.

Note: This dropin only works with kubeadm and kubelet v1.11+

[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"

This is a file that kubeadm init and kubeadm join generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically

EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env

This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use

The .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.

EnvironmentFile=-/etc/sysconfig/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS

It does not have Cgroup driver variable . So in this case how should we proceed the installation .

-- Balakumar Ezhilmaran
kubeadm
kubernetes

1 Answer

6/29/2018

First of all ensure that besides kubeadm you also installed kubelet and kubectl. If not, install them.

yum install -y kubelet kubectl

Check if Docker has been started with cgroup driver systemd.

docker info | grep -i cgroup

Modify your 10-kubeadm.conf file and add a new string.

Environment="KUBELET_CGROUP_ARGS=--cgroup-driver=systemd"

Additionally, you have to add $KUBELET_CGROUP_ARGS variable to the ExecStart section.

And as a final step, reload systemd manager configuration and restart kubelet service as described here.

systemctl daemon-reload && service kubelet restart

UPDATE

Since version 1.11 Kubernetes automatically detects the right cgroup driver and you can just skip step about settings of cgroup driver. That is from the changelog:

kubeadm now detects the Docker cgroup driver and starts the kubelet with the matching driver. This eliminates a common error experienced by new users in when the Docker cgroup driver is not the same as the one set for the kubelet due to different Linux distributions setting different cgroup drivers for Docker, making it hard to start the kubelet properly. (#64347, @neolit123)

-- mk_sta
Source: StackOverflow