Reduce kubelet.service startup failure errors during node installation

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>
This commit is contained in:
Boovan Rajendran
2025-09-23 06:12:04 -04:00
parent a1bc0e5ad6
commit 59fd01b093

View File

@@ -1,4 +1,7 @@
# 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"