Bird
0
0

Given this Pod spec snippet, what will be the output of the init container's command?

medium📝 Command Output Q4 of 15
Kubernetes - Pods
Given this Pod spec snippet, what will be the output of the init container's command?
initContainers:
- name: init-echo
  image: busybox
  command: ['sh', '-c', 'echo Hello Init']
AThe Pod logs will show 'Hello Init' from the init container
BThe Pod will fail because 'echo' is not a valid command
CThe init container will run but produce no output
DThe main container will print 'Hello Init' instead
Step-by-Step Solution
Solution:
  1. Step 1: Understand init container command execution

    The init container runs the command 'echo Hello Init' inside busybox, which prints to its logs.
  2. Step 2: Identify where output appears

    The output appears in the init container logs, visible via kubectl logs for that init container.
  3. Final Answer:

    The Pod logs will show 'Hello Init' from the init container -> Option A
  4. Quick Check:

    Init container command output = Pod logs [OK]
Quick Trick: Init container output appears in its logs [OK]
Common Mistakes:
  • Assuming main container prints init container output
  • Thinking 'echo' is invalid in busybox
  • Believing init container runs silently without output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes