Skip to content

Debugging Pods & Diagnosing Failures

When a pod fails or remains in a non-running state, follow this step-by-step diagnostic workflow:

The primary command for finding why Kubernetes rejected or failed a pod:

Terminal window
kubectl describe pod <pod-name> -n sci-myproject

Look at the Events section at the bottom:

  • FailedScheduling: Namespace quota exceeded or no nodes have the requested GPU/RAM available.
  • ImagePullBackOff: Docker registry authentication required or image tag misspelled.
  • ErrImagePull: Harbor registry inaccessible.

Terminal window
# View standard output and error streams
kubectl logs <pod-name> -n sci-myproject
# If the container crashed, inspect logs from the previous instance
kubectl logs <pod-name> --previous -n sci-myproject
# Stream live logs
kubectl logs -f <pod-name> -n sci-myproject

Exit Reason / CodeMeaningRemediation
OOMKilled (Exit Code 137)Container exceeded memory limitsIncrease resources.limits.memory in your pod manifest
CrashLoopBackOff (Exit Code 1)Python exception or fatal binary exitRun kubectl logs to inspect traceback
Exit Code 127Command or entrypoint binary not foundVerify $PATH or command syntax in your Dockerfile
CUDA Out of MemoryPyTorch allocated more VRAM than GPU hasReduce batch size or switch from A100 (80GB) to H100 (80GB) / multi-GPU

Step 4: Launching an Ephemeral Debug Shell

Section titled “Step 4: Launching an Ephemeral Debug Shell”

To inspect the filesystem of a failing pod without altering its configuration:

Terminal window
kubectl debug -it <pod-name> --image=busybox:latest -n sci-myproject -- target=worker