How do you debug a pod stuck in CrashLoopBackOff?
CrashLoopBackOff means the container starts but repeatedly crashes. Use this systematic approach:
- Check logs:
kubectl logs <pod> --previousto see the crash output. - Describe the pod:
kubectl describe pod <pod>to inspect Events, resource limits, and probe failures. - Check OOM: If you see
OOMKilled, the container exceeded its memory limit. - Shell override: Override the entrypoint to keep the container alive for inspection:
command: ["sleep", "3600"]