top of page

How to Fix Common Kubernetes Error Status

Aug 18

4 min read

0

13

Operating mission-critical applications in a Kubernetes production environment can lead to various technical challenges. We aim to provide insights into these How to Fix Common Kubernetes Error Status to assist you in recognizing them and knowing what to focus on when troubleshooting, thereby saving time in finding solutions.



kubernetes cluster and pods with error
kubernetes cluster and pods with error


Common Kubernetes Error Status # 1: Pod Stuck in Pending Status


Description

Cluster scheduler is unable to schedule a workload, such as pods, on a specific node, it is typically due to the Kubernetes Cluster surpassing its capacity limit for accommodating additional pods during scaling. This issue arises from the absence of auto-scaling on the worker node virtual machines. Additionally, it may occur when the cumulative CPU or Memory requirements of the pods exceed the overall capacity of nodes in the Kubernetes Cluster.


It is important to verify the specific nodeSelector configuration to ensure it is directing resources, such as persistent volumes attached to a particular node or meeting availability zone requirements for workloads, such as in the case of EKS.


Troubleshooting

Examine the events shown in the workload by running the command

kubectl describe <workload> -n <namespace>


If the event indicates that there are 0 available nodes and unscheduled pods, you can resolve this by either:

  • Add a new worker node VM manually.

  • Increase the maximum node limit in the Kubernetes Cluster autoscaler.



Common Kubernetes Error Status # 2: ImagePullBackOff


Description

Workload such as a pod is unable to retrieve an image, it is known as an ImagePullBackOff issue. This can happen if the image does not exist or if there is an access problem with the registry from which it is being fetched. Consequently, the pod fails to start and displays an ImagePullBackOff status.


Troubleshooting

It is important to examine the events shown in the workload by issuing a command

# kubectl describe <workload> -n <namespace>


In the Events section, verify the displayed information to determine if a repository does not exist or if there is an authorization failure. Depending on the errors indicated, you may need to take the following actions: ensure that your workload specifies the correct image registry and image tag, or verify your authorization to retrieve the image.

You may use the command

# docker pull <image>:<tag>


Common Kubernetes Error Status # 3: CrashLoopBackOff


Description

The Pod has initiated the execution of a workload, but it repeatedly crashes and restarts, leading to the status of CrashLoopBackOff. This status indicates that an error is hindering the proper startup of the Pod, often caused by the application running within the Pod or a necessary requirement for the workload to function.


Troubleshooting

Examine the events shown in the workload by doing

# kubectl describe <workload> -n <namespace>.


You will be able to identify the cause of the crash loop, such as errors and the previous state of the pod, from this point. Since application-related issues are often the main problem, it is also helpful to obtain the application logs by performing.

# kubectl logs <pod> -n <namespace> --previous --timestamps


--previous flags show us the previous logs of the pod before restarting and does will help us knowing the reason of the restart.


--timestamps will show the timestamp of the log that will also help from troubleshooting the issue. Examine the logs and check what application adjustment needs to be done. It maybe a misconfiguration on the config file, typo on command arguments or a bugs/exception in the application logic.


Another factor that could be responsible is related to network and resource considerations. This could involve a port that cannot bind, insufficient resource requirements for the application to launch, or inadequate permissions to access the filesystem.



Common Kubernetes Error Status # 4: Node NotReady status


Description

A node status in a Kubernetes Cluster that states that it cannot be used to run a workload like pods. Common reasons for this error are a lack of resources on the node, a problem with the node's kubelet, or an error related to the kube-proxy.



Troubleshooting

Verify your node's system resources. This may be a disk space issue, memory, or processing power to run Kubernetes workloads. If non-Kubernetes processes on the node are taking up too many resources, it can be marked as NotReady.


 Check your node's kubelet. This can be done by checking the node thru

# kubectl describe node <node name>

and look for the Conditions Section. If conditions are all unknown, this means that that the kubelet is down.


Verify the Kube-Proxy status by inspecting the kube-proxy workload running in the kube-system namespace using the command


# kubectl get pod -n kube-system


Review both the status and logs of the kube-proxy workload. Any errors displayed may lead to nodes in the Kubernetes Cluster becoming unavailable or entering a NotReady state. To address this, analyze the kube-proxy logs by executing the appropriate command.


# Kubectl logs <pod-name> -n kube-system


This will assist in initiating the resolution of the issue. Additionally, it is recommended to verify the compatibility of the version with your Kubernetes Cluster, as well as ensuring that the versions of coredns and CNI used are compatible with your Kubernetes Cluster. This information can provide guidance for addressing the problem, but it is important to be aware that if simple solutions are ineffective, a more intricate diagnosis may be necessary to pinpoint a comprehensive resolution.


 Look into network connectivity, another reason might be the node's connectivity to the control plane. To check run


# kubectl describe node <name>


and look in the Conditions section. If this shows NetworkUnavailable flag to True, this means there is a connectivity issue on the node. As a resolution, check your node's network connectivity towards the Kubernetes Cluster's control plane.


Teodoro Rico III(Perry):

Teodoro Rico III (Perry) is a technology executive from the Philippines, currently working as a First Vice-President in the financial sector. He is a Cloud Architect, Cloud Infrastructure, and DevSecOps expert, proficient in both strategy, business case, and hands-on experience. 

bottom of page