Kubelet service is failing due to error "failed to load Kubelet config file" in RHOCP 4
Environment
- Red Hat OpenShift Container Platform (RHOCP)
- 4
Issue
-
Kubeletservice is failing to start with below error:Jul 25 13:31:09 worker-0.xx.xx.com kubenswrapper[711539]: E0725 13:31:09.897450 711539 run.go:74] "command failed" err="failed to load kubelet config file, error: failed to load Kubelet config file /etc/kubernetes/kubelet.conf, error failed to read kubelet config file \"/etc/kubernetes/kubelet.conf\", error: open /etc/kubernetes/kubelet.conf: no such file or directory, path: /etc/kubernetes/kubelet.conf"
Resolution
-
Obtain a copy of the
kubelet.conffile from ahealthy nodewithin the sameRHOCPcluster. This can be done through various methods likescpor manually copying the file contents. Ensure that thepermissions and ownershipof the copied file are consistent with the original. -
Place the copied
kubelet.conffile in the correct path on the affected node, which is typically/etc/kubernetes/kubelet.conf. -
Restart the
kubeletservice to load the newly placedconfiguration file. This can be achieved using the following command:$ systemctl restart kubelet
Root Cause
- The root cause of the error is the missing
Kubelet configuration file(kubelet.conf) in the expected location/etc/kubernetes/kubelet.conf, preventing theKubeletservice from starting correctly on the worker node.
Diagnostic Steps
-
Review the
kubeletlogs for errors related to loading theconfiguration file. Filter for relevant messages using this command:$ journalctl -u kubelet.service | grep -i "error: failed to load Kubelet config file" Jul 25 14:17:48 worker-0.url.com kubenswrapper[716800]: E0725 14:17:48.163177 716800 run.go:74] "command failed" err="failed to load kubelet config file, error: failed to load Kubelet config file /etc/kubernetes/kubelet.conf, error failed to read kubelet config file \"/etc/kubernetes/kubelet.conf\", error: open /etc/kubernetes/kubelet.conf: no such file or directory, path: /etc/kubernetes/kubelet.conf" -
Check if
kubelet.conffile is missing:$ ls -lrt /etc/kubernetes/kubelet.conf ls: cannot access '/etc/kubernetes/kubelet.conf': No such file or directory
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments