Bird
0
0

What is the output of the command kubectl logs my-pod if the pod has multiple containers?

medium📝 Command Output Q5 of 15
Kubernetes - Monitoring and Logging
What is the output of the command kubectl logs my-pod if the pod has multiple containers?
ALogs from the first container only
BLogs from all containers concatenated
CAn error asking to specify the container name
DNo output, command fails silently
Step-by-Step Solution
Solution:
  1. Step 1: Recall kubectl logs behavior

    If a pod has multiple containers, kubectl logs requires container name to avoid ambiguity.
  2. Step 2: Check other options

    It does not concatenate logs or silently fail.
  3. Final Answer:

    An error asking to specify the container name -> Option C
  4. Quick Check:

    Multiple containers require container name in logs command [OK]
Quick Trick: Specify container name when pod has multiple containers [OK]
Common Mistakes:
  • Expecting logs from all containers without specifying
  • Assuming silent failure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes