Bird
0
0

You want to debug a pod that crashed and restarted. Which command shows logs from the previous container instance?

hard📝 Application Q8 of 15
Kubernetes - kubectl Essential Commands
You want to debug a pod that crashed and restarted. Which command shows logs from the previous container instance?
Akubectl logs mypod -c previous
Bkubectl logs mypod --follow
Ckubectl logs mypod --tail=10
Dkubectl logs mypod --previous
Step-by-Step Solution
Solution:
  1. Step 1: Identify flag for previous container logs

    The --previous flag fetches logs from the last terminated container instance.
  2. Step 2: Compare other options

    --follow streams current logs, --tail=10 shows last 10 lines, and -c previous is invalid container name usage.
  3. Final Answer:

    kubectl logs mypod --previous -> Option D
  4. Quick Check:

    Previous container logs = --previous flag [OK]
Quick Trick: Use --previous to see logs from crashed container [OK]
Common Mistakes:
  • Using --follow for old logs
  • Using wrong container name
  • Ignoring --previous flag

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes