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 .
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 Dockercgroup
driver and starts thekubelet
with the matching driver. This eliminates a common error experienced by new users in when the Dockercgroup
driver is not the same as the one set for thekubelet
due to different Linux distributions setting differentcgroup
drivers for Docker, making it hard to start thekubelet
properly. (#64347, @neolit123)