Kubernetes
Debugging
Not Ready state
Nodes
Troubleshooting

How to debug when Kubernetes nodes are in 'Not Ready' state

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

When managing a Kubernetes cluster, encountering nodes in a 'Not Ready' state can be quite a common challenge. Dealing effectively with this requires not only understanding the underlying causes but also knowing the appropriate steps for rectification. Below, we'll explore various reasons why your nodes might be in a 'Not Ready' state and the actions you can take to resolve such issues.

Understanding the 'Not Ready' State

Nodes in Kubernetes go into a 'Not Ready' state when they fail to meet certain conditions that affect their ability to run pods reliably. The Kubernetes node status comprises several conditions like Ready, DiskPressure, MemoryPressure, PIDPressure, and NetworkUnavailable. A node is marked as 'Not Ready' when it fails to satisfy the Ready condition.

Possible Causes

1. Network Issues

Symptom:

Nodes might not have network connectivity with the API server or face issues in the network overlay.

Solutions:

  • Check the network connectivity using tools such as ping or curl to communicate with the API server.
  • Verify the status of network plugins like Weave, Calico, or Flannel by checking logs and service status.

2. Node Resource Pressure

Nodes may experience pressure on CPU, memory, or disk due to various workloads.

Solutions:

  • Disk Pressure:
    Use the command df -h to ensure sufficient disk space is available. Clean up unnecessary files/logs or increase disk space.
  • Memory Pressure:
    Use top or free -m to check memory usage. Consider increasing node memory or optimizing workloads.
  • PID Pressure:
    Check the number of processes using ps aux | wc -l and increase allowable processes or optimize those running.

3. API Server Connection Issues

If the node cannot connect to the API server, it might be due to improper configuration or unreachable endpoints.

Solutions:

  • Ensure the kubelet on the node has the correct endpoint and port.
  • Validate using kubectl logs for errors related to kubelet communication.

4. Kubelet Issues

Sometimes, kubelet failures or crashes can affect node readiness.

Solutions:

  • Restart kubelet using systemctl restart kubelet or service kubelet restart.
  • Check logs via journalctl -u kubelet for errors.
  • Ensure the kubelet configuration is correct.

5. Certificate Issues

Expired or improper certificates can cause authentication failures.

Solutions:

  • Use kubectl get nodes and kubectl describe node <node-name> to ensure certificates are up-to-date.
  • Renew certificates if required and restart services.

6. Docker/Container Runtime

The container runtime (e.g., Docker, containerd) might be malfunctioning or misconfigured.

Solutions:

  • Restart the service using systemctl restart docker or service docker restart.
  • Check logs for errors and rectify configurations or dependencies.

Key Commands for Diagnosis

 
1# Describe node details
2kubectl describe node <node-name>
3
4# Check system logs
5journalctl -u kubelet
6
7# Check node metrics
8top
9free -m
10df -h
11
12# Check Docker status
13systemctl status docker

Summary Table

IssueSymptomsSolutions
Network IssuesLoss of connection to APICheck connectivity Validate network plugin
Resource PressureHigh CPU/Memory/Disk usageClean unnecessary files Optimize workloads
API Server IssuesFailure to communicateValidate kubelet endpoint Check logs for errors
Kubelet ErrorsKubelet crashing/stoppedRestart kubelet Check logs for insight
Certificate ProblemsAuthentication failureVerify certificates Renew if expired
Container Runtime IssuesDocker not running smoothlyRestart Docker Check Docker logs

Advanced Debugging Tips

  1. Set node taints: Isolate nodes by setting taints to prevent new pod assignments, allowing you to remediate issues without impacting workloads.
  2. Use tools like kubectl top: Gain insights into node and pod metrics, helping you identify resource-heavy components.
  3. Enable and analyze audit logs: Deep dive into Kubernetes audit logs to identify suspicious or erroneous activities affecting node status.
  4. Consider node replacements: If persistent issues exist or the node hardware is faulty, replacing the node might be the best recourse.
  5. Cluster autoscaler considerations: Ensure configurations for the cluster autoscaler are also aligned to handle nodes moving to unsustainable states.

Understanding the reasons that contribute to a node being 'Not Ready' and taking systematic actions is vital for maintaining a robust and healthy Kubernetes cluster. By following the steps and solutions outlined above, you can quickly address and rectify node-related issues, thereby ensuring your cluster remains reliable and efficient.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track 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.

Practice system design

All Rights Reserved.