
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
andReason
.
πΉ 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? π