Kubelet service is failing due to error "failed to load Kubelet config file" in RHOCP 4

Solution Verified - Updated -

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4

Issue

  • Kubelet service 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.conf file from a healthy node within the same RHOCP cluster. This can be done through various methods like scp or manually copying the file contents. Ensure that the permissions and ownership of the copied file are consistent with the original.

  • Place the copied kubelet.conf file in the correct path on the affected node, which is typically /etc/kubernetes/kubelet.conf.

  • Restart the kubelet service to load the newly placed configuration 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 the Kubelet service from starting correctly on the worker node.

Diagnostic Steps

  • Review the kubelet logs for errors related to loading the configuration 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.conf file 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