Skip to main content

Debugging Your Kubernetes Nodes in the ‘Not Ready’ State | nodenotready

 

Nodes are a vital component of a Kubernetes cluster and are responsible for running the pods. Depending on your cluster setup, a node can be a physical or a virtual machine. A cluster typically has one or multiple nodes, which are managed by the control plane.

Because nodes do the heavy lifting of managing the workload, you want to make sure all your nodes are running correctly. The kubectl get nodes command can be used to check the state of your nodes.

Output of kubectl get nodes
Output of kubectl get nodes

A node with a NotReady status means it can’t be used to run a pod because of an underlying issue. It’s essentially used to debug a node in the NotReady state so that it doesn’t lie unused.

In this article, you’ll learn a few possible reasons why a node might enter the NotReady state and how you can debug it.

The NotReady State

As mentioned earlier, each node in a cluster is used to run pods. Before a pod is scheduled on a node, Kubernetes checks whether the node is capable of running the pod or not. The STATUS column in the output of kubectl get nodes represents the status. The possible values in this column are:

  1. Ready: The node is healthy and ready to accept pods.
  2. NotReady: The node has encountered some issue and a pod cannot be scheduled on it.
  3. SchedulingDisabled: The node is marked as unschedulable. This can be done using the kubectl cordon command.
  4. Unknown: The node is unreachable by the control plane.

Having a node in the NotReady state means that the node is effectively unused and will accumulate costs without participating in running pods. Furthermore, losing a node can negatively impact your production workload.

In order for your application to run smoothly, you must debug them quickly.

Possible Causes of the NotReady State

There can be various reasons why a node might enter the NotReady state. This section will review some of the most common reasons for this error.

Scarcity of Resources

To operate normally, a node must have sufficient disk space, memory, and sufficient processing ability. If a node is running low on disk space or the available memory is low, it will go into the NotReady state. If pressure exists on the processes, eg too many processes are running on the node, it will also change to the NotReady state.

Network Misconfiguration

If the network has not been correctly configured on the node or it can’t reach the internet, the node will be unable to communicate with the master node and will be listed as NotReady.

Issue with kubelet Process

kubelet is an agent that runs on each node. It is responsible for communicating with the Kubernetes API server and registering the nodes. If kubelet crashes or stops on the node, it will not be able to communicate with the API Server and will be in the NotReady state.

Issue with kube-proxy

kube-proxy is a network proxy that runs on each node and maintains the network rules. These rules allow network communication to your pods from inside or outside your cluster. If kube-proxy crashes or stops, the node will be in the NotReady state.

Vendor Specific Issues

Suppose you’re using a cloud-hosted solution like GKE or EKS. In that case, some vendor-specific issues may be preventing your nodes from operating normally and communicating with the control plane. These issues could be IAM misconfiguration, misconfigured network rules, etc.

Debugging the NotReady State

As you can see, the NotReady status can be caused by a multitude of issues. This section will help you identify the root cause of the problem. However, it’s essential to understand that how you go about fixing these issues depends on the exact cause and your cluster setup. There are no one-size-fits-all solutions. But, once you identify the root cause, it should be easier to resolve it.

Check the kube-proxy Pod

First, ensure that each node has exactly one kube-proxy pod and is in the Running state.


kubectl get pods -n kube-system -o wide

The output might look like this:

NAME READY STATUS AGE IP NODE NOMINATED NODE READINESS GATES
kube-proxy-nhbtp 1/1 Running 2 (11h ago) 2d16h 192.168.99.10 1 my-cluster <none> <none>
kube-proxy-tkmsk 1/1 Running 2 (11h ago) 2d16h 192.168.99.10 3 my-cluster-m03 <none> <none>
kube-proxy-vk4ch 1/1 Running 2 (11h ago) 2d16h 192.168.99.10 2 my-cluster-m02 <none> <none>

If any one pod is in some state other than Running, use the following command to get more information:


kubectl describe pod yourPodName -n kube-system

The Events section logs the various events on the pod, and it could be an excellent place to start looking for any mishaps.

The events section in the output
The events section in the output

You can get access to the pod logs by running the following command:


kubectl logs yourPodName -n kube-system

The logs and the events list is a good place to start looking for any issues.

If your node does not have a kube-proxy pod, then you need to inspect the kube-proxy daemonset, which is responsible for running one kube-proxy pod on each node.


kubectl describe daemonset kube-proxy -n kube-system

The output of this command might reveal any possible issue with the daemonset.

Verify Resources are Available

Run the following command to get detailed information about a node that is not ready:


kubectl describe node nodeName

In the output, the Conditions section shows if the node is running out of resources or not.

The conditions section in the output
The conditions section in the output

The following conditions are available:

  1. MemoryPressure: If True, it indicates that the node is running out of memory.
  2. DiskPressure: A True value in this field indicates that the node lacks enough space.
  3. PIDPressure: If too many processes are running on the node, this field will be True.
  4. NetworkUnavailable: If the network for the node is not correctly configured, this will be True.
  5. Ready: If the node is healthy and ready to accept pods, this will be True. In this field, a False is equivalent to the NotReady status in the get nodes output. It can also have the Unknown value, which means the node controller has not heard from the node in the last node-monitor-grace-period (defaults to 40 seconds).

If any one of the first four conditions is True, you have identified the problem.

Verify kubelet is Running

If all the Conditions fields show Unknown, it might hint that the kubelet process on the node has run into some issues.

The conditions field shows unknown
The conditions field shows unknown

To debug this, first SSH into the node and check the status of the kubelet process. If it’s running as a systemd service, use the following command:


systemctl status kubelet

If the Active field shows inactive (dead), it means the kubelet process has stopped.

The active field of the output
The active field of the output

To reveal the possible reason for the crash, check the logs with the following command:


journalctl -u kubelet

Once the issue is fixed, restart kubelet with:


systemctl restart kubelet

Verify Network Communication with the Control Plane

If the Conditions field shows NetworkUnavailable, it indicates an issue in the network communication between the node and the control plane.

A few possible fixes:

  • If the node is configured to use a proxy, verify that the proxy allows access to the API server endpoints.
  • Ensure that the route tables are appropriately configured to avoid blocking communication with the API server.
  • If you’re using a cloud provider like AWS, verify that no VPC network rules block communication between the control plane and the node.

You can run the following command from within the node to verify that it can reach the API server.


nc -vz <your-api-server-endpoint> 443

If the output shows succeeded, then network communication is working correctly.

Vendor Specific Debugging

If you’re using a cloud provider like EKS, or GKE, sometimes it’s worth looking into vendor-specific issues if you’ve exhausted all other debugging techniques. EKS has an extremely detailed guide that you can follow.

GKE provides an auto repair feature that can attempt to repair a node that has been in the NotReady state for a given amount of time. If all else fails, you can always get in touch with your cloud provider for more assistance.

Comments

Popular posts from this blog

OWASP Top 10 Threats and Mitigations Exam - Single Select

Last updated 4 Aug 11 Course Title: OWASP Top 10 Threats and Mitigation Exam Questions - Single Select 1) Which of the following consequences is most likely to occur due to an injection attack? Spoofing Cross-site request forgery Denial of service   Correct Insecure direct object references 2) Your application is created using a language that does not support a clear distinction between code and data. Which vulnerability is most likely to occur in your application? Injection   Correct Insecure direct object references Failure to restrict URL access Insufficient transport layer protection 3) Which of the following scenarios is most likely to cause an injection attack? Unvalidated input is embedded in an instruction stream.   Correct Unvalidated input can be distinguished from valid instructions. A Web application does not validate a client’s access to a resource. A Web action performs an operation on behalf of the user without checking a shared sec

CKA Simulator Kubernetes 1.22

  https://killer.sh Pre Setup Once you've gained access to your terminal it might be wise to spend ~1 minute to setup your environment. You could set these: alias k = kubectl                         # will already be pre-configured export do = "--dry-run=client -o yaml"     # k get pod x $do export now = "--force --grace-period 0"   # k delete pod x $now Vim To make vim use 2 spaces for a tab edit ~/.vimrc to contain: set tabstop=2 set expandtab set shiftwidth=2 More setup suggestions are in the tips section .     Question 1 | Contexts Task weight: 1%   You have access to multiple clusters from your main terminal through kubectl contexts. Write all those context names into /opt/course/1/contexts . Next write a command to display the current context into /opt/course/1/context_default_kubectl.sh , the command should use kubectl . Finally write a second command doing the same thing into /opt/course/1/context_default_no_kubectl.sh , but without the use of k

标 题: 关于Daniel Guo 律师

发信人: q123452017 (水天一色), 信区: I140 标  题: 关于Daniel Guo 律师 关键字: Daniel Guo 发信站: BBS 未名空间站 (Thu Apr 26 02:11:35 2018, 美东) 这些是lz根据亲身经历在 Immigration版上发的帖以及一些关于Daniel Guo 律师的回 帖,希望大家不要被一些马甲帖广告帖所骗,慎重考虑选择律师。 WG 和Guo两家律师对比 1. fully refund的合约上的区别 wegreened家是case不过只要第二次没有file就可以fully refund。郭家是要两次case 没过才给refund,而且只要第二次pl draft好律师就可以不退任何律师费。 2. 回信速度 wegreened家一般24小时内回信。郭律师是在可以快速回复的时候才回复很快,对于需 要时间回复或者是不愿意给出确切答复的时候就回复的比较慢。 比如:lz问过郭律师他们律所在nsc区域最近eb1a的通过率,大家也知道nsc现在杀手如 云,但是郭律师过了两天只回复说让秘书update最近的case然后去网页上查,但是上面 并没有写明tsc还是nsc。 lz还问过郭律师关于准备ps (他要求的文件)的一些问题,模版上有的东西不是很清 楚,但是他一般就是把模版上的东西再copy一遍发过来。 3. 材料区别 (推荐信) 因为我只收到郭律师写的推荐信,所以可以比下两家推荐信 wegreened家推荐信写的比较长,而且每封推荐信会用不同的语气和风格,会包含lz写 的research summary里面的某个方面 郭家四封推荐信都是一个格式,一种语气,连地址,信的称呼都是一样的,怎么看四封 推荐信都是同一个人写出来的。套路基本都是第一段目的,第二段介绍推荐人,第三段 某篇或几篇文章的abstract,最后结论 4. 前期材料准备 wegreened家要按照他们的模版准备一个十几页的research summary。 郭律师在签约之前说的是只需要准备五页左右的summary,但是在lz签完约收到推荐信 ,郭律师又发来一个很长的ps要lz自己填,而且和pl的格式基本差不多。 总结下来,申请自己上心最重要。但是如果选律师,lz更倾向于wegreened,