Q5 AKS Domain 1 · 20–25% of exam

A pod is in CrashLoopBackOff. Which command shows the output of the container instance that just crashed?

  1. A kubectl logs <pod> --previous (correct answer)
  2. B kubectl get events --watch
  3. C kubectl top pod <pod>
  4. D kubectl get endpoints

Shortcut: Why did my container crash? = kubectl logs --previous. Events show scheduling and probe problems but not application output, kubectl top shows CPU and memory use, and endpoints show which pods a Service sends traffic to.

kubectl logs --previous prints the logs of the previous, crashed container instance, which is usually where the error is. Events show scheduling and probe problems but not application output, kubectl top shows CPU and memory use, and endpoints show which pods a Service sends traffic to.