
During node install/reinstall there is lot of kubelet.service startup failure errors occurs. This adds systemd ConditionPathExists to kubelet.service to prevent kubelet from starting before necessary configuration files are created during bootstrap of a Kubernetes node Note: The kubelet.service requires the following configuration files to start successfully: /etc/default/kubelet /etc/kubernetes/kubelet.conf /var/lib/kubelet/config.yaml we are intentionally excluding /etc/kubernetes/kubelet.conf from this change. This is because during the kubeadm join process, the kubelet is started before this file is generated. Adding a systemd condition that checks for the existence of /etc/kubernetes/kubelet.conf will cause the kubelet to fail to start, resulting in the kubeadm join command failing due to an unhealthy kubelet. Test Plan: PASS: Install ISO as AIO-SX,AIO-DX and Standard, verify kubelet.service starts properly and start errors are reduced. PASS: Perform factory install using dc-libvirt and verify kubelet.service starts properly and start errors are reduced. Closes-Bug: 2125480 Change-Id: Iaf89ac8f87bf3981d72bf091c53709ebc5f1d72e Signed-off-by: Boovan Rajendran <boovan.rajendran@windriver.com>
21 lines
1.2 KiB
Plaintext
21 lines
1.2 KiB
Plaintext
# Note: This dropin only works with kubeadm and kubelet v1.11+
|
|
[Unit]
|
|
ConditionPathExists=/etc/default/kubelet
|
|
ConditionPathExists=/var/lib/kubelet/config.yaml
|
|
[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/default/kubelet
|
|
ExecStart=
|
|
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
|
|
ExecStartPre=-/usr/local/sbin/sanitize_kubelet_reserved_cpus.sh /etc/default/kubelet
|
|
ExecStartPre=-/usr/bin/kubelet-cgroup-setup.sh
|
|
ExecStartPost=/bin/bash -c 'echo $MAINPID > /var/run/kubelet.pid;'
|
|
ExecStopPost=/bin/rm -f /var/run/kubelet.pid
|
|
StartLimitInterval=0
|
|
RestartSec=10
|