kubeadm init shows kubelet isn't running or healthy
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Running Kubernetes can sometimes present challenges, especially during the initialization phases using kubeadm. One common issue users may encounter is the message indicating “kubelet isn’t running or healthy” during the execution of kubeadm init. This document aims to dissect the causes of this problem and provide comprehensive guidance on how to troubleshoot and resolve it.
Understanding Kubeadm and Kubelet
kubeadm is a tool used for initializing a Kubernetes cluster. It automates many of the complex steps required to bootstrap a cluster and provides simple commands for setting up a single-node or multi-node cluster. On the other hand, kubelet is the node agent that runs on every cluster node. It is responsible for managing the containers running on the node, ensuring that the pods are running and are in a healthy state.
When using kubeadm init, kubelet should be active and healthy to ensure the pods are managed successfully. The message “kubelet isn’t running or healthy” signifies that there may be an issue with kubelet, preventing successful initialization.
Common Causes and Troubleshooting
The problem can be attributed to various factors which are essential to check and troubleshoot in a systematic manner:
System Configuration Issues
- Incorrect Swap Settings: Kubernetes requires the swap memory to be disabled for nodes. If swap is enabled, it can cause kubelet to fail.
- Incorrect Firewall Rules: Ports used by Kubernetes components must be open.
- Ensure that ports like
6443,2379-2380,10250, etc., are open.
Inadequate Resources
- Insufficient System Resources: Make sure that your system meets the minimum requirements needed to run Kubernetes components.
- Nodes Running Out of Memory or CPU: This can also cause kubelet to fail.
Kubelet Configuration File Issues
- Invalid Configurations: Verify that
kubeletconfiguration files are correct and not corrupted. Configuration files are often located under/etc/systemd/system/kubelet.service.d/.
Logs and Error Messages
- Reviewing logs can provide insights. Access
kubeletlogs using:
Look for any error messages that may direct you toward the root cause.
Missing CNI Plugins
- Pod Network Plugin: Make sure a network plugin is properly installed, e.g., Flannel or Calico.
Incompatible Kubernetes and OS Versions
- Ensure that both Kubernetes version and OS are compatible.
- Check the Kubernetes version skew policy to make sure they align.
Comprehensive Checklist
Let's look at a summary checklist presented in table form to aid in troubleshooting:
| Potential Cause | Explanation | Solution |
| Swap Enabled | Kubernetes requires swap to be disabled. | Disable swap using swapoff -a and edit /etc/fstab. |
| Firewall Blocking Ports | Certain ports need to be open. | Check and open requisite ports like 6443, 2379-2380, and 10250. |
| CPU/Memory Constraints | Resource limitation can cause kubelet to fail. | Ensure system resources are adequate. |
| Invalid Kubelet Configuration | Misconfigured settings or parameters. | Check and correct configuration files under /etc/systemd/system/kubelet.service.d/. |
| CNI Plugin Not Installed | Network plugins are needed for pod communication. | Make sure a CNI plugin is applied, e.g., Flannel or Calico. |
| Incompatible Versions | Incompatibility between Kubernetes and OS versions. | Verify version compatibility and conformance to the Kubernetes version skew policy. |
Additional Considerations
Understanding Systemd's Role
Kubelet runs as a systemd service; understanding how to interact with systemd can be valuable:
Practical Example
Consider running a debug process if you suspect a deeper issue. Using tools like top or htop to monitor resources, netstat to check open ports, and further using strace and lsof for tracing and listing open files or network connections can be beneficial.
Leveraging Community and Documentation
When going through complex issues, don't hesitate to scrutinize the Kubernetes official documentation, seek community help, or engage in forums such as Kubernetes Slack.
By following these recommendations and closely analyzing both the logs and the existing system configurations, you can often navigate through the "kubeadm init shows kubelet isn't running or healthy" error and successfully bootstrap a Kubernetes cluster.
Related reading
- kubectl --dry-run is deprecated and can be replaced with --dry-runclient
- kubectl apply vs kubectl create?
- kubectl attach Unable to use a TTY - container es-node did not allocate one
- Kubectl attach vs kubectl exec?
- Kubectl command to return a list of all user accounts from Kubernetes
- Kubectl create for persistent storage erroring out
- kubectl bash completion doesn't work in ubuntu docker container
- kubectl cp error one of src or dest must be a remote file specification

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.