Bird
0
0

You run kubectl logs mypod -c unknowncontainer and receive an error. What is the most likely cause?

medium📝 Troubleshoot Q7 of 15
Kubernetes - kubectl Essential Commands
You run kubectl logs mypod -c unknowncontainer and receive an error. What is the most likely cause?
AThe pod is not running
BThe specified container name does not exist in the pod
CYou need to add the --all-containers flag
DThe pod has no logs available yet
Step-by-Step Solution
Solution:
  1. Step 1: Understand error cause

    An error about container not found usually means the container name is invalid.
  2. Step 2: Check container names

    Verify container names in the pod; if unknowncontainer is not present, error occurs.
  3. Final Answer:

    The specified container name does not exist in the pod -> Option B
  4. Quick Check:

    Container name must match exactly [OK]
Quick Trick: Container name must exist in pod spec [OK]
Common Mistakes:
  • Assuming pod status causes container not found error
  • Using --all-containers flag incorrectly
  • Expecting logs when container name is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes