study.

The First Five Minutes of Pod Troubleshooting · CKA

Inspect status, then events, then logs. Gather evidence instead of guessing.

← CKA

Learn with progress and quizzes

First, understand the concepts.

Status and events

Pending, ImagePullBackOff, and CrashLoopBackOff suggest different starting points. Events in describe provide clues about scheduling or image downloads.

Current and previous logs

For a repeatedly restarting container, --previous retrieves logs from its previous instance. The request cannot return those logs if no previous instance exists.

Why it matters

“The Pod will not start” can mean placement failure, image preparation failure, process termination, or failed readiness. Split these before restarting anything.

Work through the reasoning

Choose the first branch

For Pending, inspect PodScheduled and Events. For ImagePullBackOff, inspect image references and pull events. CrashLoopBackOff describes retry backoff; inspect termination reasons, exit codes, and prior logs.

Connect time and container identity

Find the failing container in containerStatuses and choose it with logs -c. --previous retrieves its previous container instance, not an unlimited log archive. Record event times and restart counts together.

Learn by doing.

You need kubectl and access to your own practice Kubernetes cluster. Each lab is independent. Check your current context first, then run the commands in your own terminal.

Choose a Pod to investigate and replace POD_NAME and NAMESPACE with its actual values.

kubectl get pods -A
kubectl describe pod POD_NAME -n NAMESPACE
kubectl logs POD_NAME -n NAMESPACE --tail=50
kubectl logs POD_NAME -n NAMESPACE --previous --tail=50
kubectl get events -n NAMESPACE --sort-by=.metadata.creationTimestamp

How to check your result

Write one line each for the symptom, supporting evidence, and next command. If the Pod has multiple containers, select one with -c.

Apply what you learned

Logs are empty and the state says CreateContainerConfigError. Should you change application code first?

Reveal the reasoning after trying

The container may never have started. Inspect events for missing Secrets, ConfigMaps, or keys and compare references with the spec. Empty application logs are expected when startup fails before process execution.

Ready to check your understanding?

How do you read logs from the container instance before its restart?

  1. kubectl get logs
  2. kubectl logs POD --previous
  3. kubectl describe node
  4. kubectl logs POD --future
Reveal the reasoning after trying

kubectl logs POD --previous

--previous requests logs from the previous terminated container instance.

Kubernetes documentation