Use it as the entry point when a container or pod is not working.
Container Troubleshooting
Container troubleshooting follows the pod lifecycle: scheduling, image pull, container start, probes and runtime behaviour, using status, events, logs and exec.
1. kubectl get pod — status and restarts.
2. kubectl describe pod — events.
3. kubectl logs <pod> --previous.
4. kubectl exec -it <pod> -- sh (or kubectl debug).
5. Fix and watch kubectl get pod -w.
schedule → pull → start → probes → running
The biggest diagnostic errors are restarting before capturing the original reason, assuming CrashLoopBackOff is the root cause rather than backoff behavior, treating Pending as a runtime failure, or widening permissions/network policy without proving that layer is responsible. Preserve the first divergent observation and repeat the same bounded verification after remediation.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
This Topic owns cross-container failure triage. Deep host, network, storage, security and telemetry diagnosis remains in the responsible Domain and should be linked rather than duplicated.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification workflow Verify boundary
Start with the object/container current state, reason, exit code and event timeline. Preserve the first concrete error, then test the adjacent dependency using stable identity: image digest, Pod/container ID, node, volume or service endpoint. After repair, rerun the original bounded check and verify the consumer-visible service.
Step 2 Failure signatures and limits Narrow the fault
The biggest diagnostic errors are restarting before capturing the original reason, assuming CrashLoopBackOff is the root cause rather than backoff behavior, treating Pending as a runtime failure, or widening permissions/network policy without proving that layer is responsible.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Subtopics
Go one level deeper into this subject.
CrashLoopBackOff means a container keeps exiting and the kubelet waits longer between each restart.
Subtopic ImagePullBackOff and ErrImagePullImagePullBackOff means the kubelet could not pull the container image and is waiting before trying again.
Subtopic Pods Stuck in PendingA Pending Pod has been accepted by the API server but not scheduled to a node, or is waiting for volumes.
Subtopic Debugging with kubectl exec and Ephemeral Containerskubectl exec runs commands in a running container; kubectl debug adds an ephemeral container with tools when the image has none.
Read status and events first (describe), then logs (--previous for crashes), then exec into the container. Typical states: Pending, ImagePullBackOff, CrashLoopBackOff, OOMKilled, not Ready.
kubectl get pod— first check for this topickubectl get pods -o wide— pods, status, node, IPkubectl describe pod <pod>— events and conditionskubectl logs <pod> [-c <c>] [--previous]— container logs (incl. previous crash)kubectl get events --sort-by=.lastTimestamp— recent cluster events
ReferenceWhat it is1 section · depth on demand
Operating model
Container Troubleshooting is a failure-signature index across runtime and Kubernetes layers. The goal is to identify the first step that has not been verified—image acquisition, scheduling, runtime creation, process exit, networking, storage, node capacity or application readiness—rather than retrying everything at once.
ReferenceHow it works1 section · depth on demand
In depth
Container troubleshooting starts by asking the platform what it observed — events, status and logs — before entering the container. Most problems fall into a handful of patterns.
| Symptom | Likely cause | First check |
|---|---|---|
ImagePullBackOff / pull errors | Wrong name/tag, missing registry credentials, rate limits | kubectl describe pod, docker pull |
CrashLoopBackOff / container exits | Application error, bad config, missing env/secret | kubectl logs --previous, docker logs |
OOMKilled | Memory limit too low or leak | kubectl describe pod (Last State) |
Pending | No node fits requests/affinity, unbound PVC | Events: FailedScheduling |
| Service unreachable | Selector mismatch, no ready endpoints, NetworkPolicy | kubectl get endpointslices, probes |
| Works locally, not in cluster | DNS, env differences, permissions (non-root, read-only FS) | Compare specs |
kubectl get events -n apps --sort-by=.lastTimestamp | tail
kubectl debug -it <pod> --image=busybox --target=<container>
docker inspect --format '{{.State.ExitCode}} {{.State.Error}}' app
Exit codes help: 137 = killed (often OOM), 139 = segmentation fault, 1/2 = application error.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Configuration & expected output
Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.
Configuration example
Assumptions: Replace namespace and Pod name.
kubectl -n app get pod api-6d9f7c-abcde -o wide
kubectl -n app describe pod api-6d9f7c-abcde
kubectl -n app logs api-6d9f7c-abcde --previous
kubectl -n app get events --sort-by=.lastTimestamp | tail -20Expected output
kubectl -n app get pod api-6d9f7c-abcdeExpected state: A healthy Pod is Running with all containers ready and a stable restart count.
NAME READY STATUS RESTARTS AGE
api-6d9f7c-abcde 1/1 Running 0 12mCrashLoopBackOff points to the container exiting (read logs --previous); ImagePullBackOff to registry or credentials; Pending to scheduling (read describe events). Illustrative authored output: field layout matches the tool, values will differ in your environment.Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Documentation verification: confirms the upstream model used by the Topic. It does not assert local production behavior.
Basis: https://kubernetes.io/docs/tasks/debug/ · confidence 92%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Container Troubleshooting verification boundary matrix
A compact lookup separating intent, owning component state, effective state and consumer-visible outcome for Container Troubleshooting.
| Boundary | Inspect | Healthy interpretation | Do not infer |
|---|---|---|---|
| Intent | ImagePullBackOff / ErrImagePull | Intended object/scope is explicit and versioned where relevant | Intent is already effective |
| Owning runtime/control plane | CrashLoopBackOff / Pending Pods | Owner accepts and reports the expected object state | Downstream dependencies are healthy |
| Effective state | OOMKilled | Independent read-back matches the intended state | Every client sees the same result |
| Consumer outcome | DNS/service reachability | The original bounded check succeeds in the same time window | Production correctness outside this scope |
Deep reference
Design & tradeoffs
Scope
Deep host, network, storage, security and telemetry diagnosis remains in the responsible Domain and should be linked rather than duplicated.