Debugging and Troubleshooting Pods
Troubleshooting Kubernetes pods involves inspecting logs, events, pod status, and more. Here are key commands and approaches:
Check Pod Description:
kubectl describe pod
Debug a Stuck Pod:
kubectl exec -it -- /bin/sh
If the pod isn't running, you can temporarily attach a debug container:
kubectl run debug --image=busybox -it --rm --restart=Never -- sh
Common Issues:
- CrashLoopBackOff: Application crashing repeatedly
- ImagePullBackOff: Failed to pull container image
- Pending: Pod can't be scheduled (check node capacity or affinity rules)