How do you check if a pod is running properly or not in Kubernetes

To deeply check if a Kubernetes pod is running properly, follow these detailed steps:


πŸ”Ή Step 1: Check Pod Status

Run the following command:

kubectl get pods -n <namespace>

Example output:

NAME                     READY   STATUS    RESTARTS   AGE
my-app-5f57b5b7f4-abcde   1/1     Running   0          10m

βœ… Running means the pod is active.

⚠️ If the pod is stuck in Pending, CrashLoopBackOff, or Evicted, further investigation is needed.


πŸ”Ή Step 2: Check Pod Events for Issues

kubectl describe pod <pod-name> -n <namespace>

Look at:

  • Events Section β†’ Check for failures like image pull issues, scheduling problems, or liveness probe failures.
  • Status Section β†’ If a container is restarting frequently, check Last State and Reason.

πŸ”Ή Step 3: Check Pod Logs

To check logs for debugging:

kubectl logs <pod-name> -n <namespace>

For multi-container pods:

kubectl logs <pod-name> -n <namespace> -c <container-name>

For live logs (streaming):

kubectl logs -f <pod-name> -n <namespace>

πŸ”Ή Step 4: Check Resource Usage (CPU/Memory)

kubectl top pod <pod-name> -n <namespace>

Example output:

NAME                     CPU(cores)   MEMORY(bytes)   
my-app-5f57b5b7f4-abcde   120m        256Mi          

If memory or CPU usage is very high, consider scaling or optimizing the workload.


πŸ”Ή Step 5: Check Container-Level Issues

kubectl get pods -o wide -n <namespace>
  • Check NODE ASSIGNMENT: Ensure the pod is scheduled on a healthy node.
  • Check RESTART COUNT: Frequent restarts indicate issues.

πŸ”Ή Step 6: Check Node Health (If Needed)

kubectl get nodes

If a node is NotReady, describe the node for more details:

kubectl describe node <node-name>

πŸ”Ή Step 7: Check Network Connectivity

To exec into a running pod and check connectivity:

kubectl exec -it <pod-name> -n <namespace> -- /bin/sh

Then try:

ping <another-pod>
curl http://<service-name>:<port>

πŸ”Ή Step 8: Check Persistent Volume (PV) & Mount Issues

kubectl get pvc -n <namespace>
kubectl describe pvc <pvc-name> -n <namespace>

Ensure the PV is bound and not failing.


βœ… Conclusion

If your Pod is not running, check:
βœ… Pod events (describe pod)
βœ… Container logs (kubectl logs)
βœ… Resource usage (kubectl top pod)
βœ… Network issues (kubectl exec + curl/ping)
βœ… Node health (kubectl describe node)

Would you like to automate health checks & alerts for failed pods? πŸš€

About Anant 441 Articles
Senior technical writer