Bird
0
0

Which of the following is the correct syntax to define an init container in a Kubernetes Pod spec?

easy📝 Syntax Q12 of 15
Kubernetes - Pods
Which of the following is the correct syntax to define an init container in a Kubernetes Pod spec?
Acontainers: - name: init-example image: busybox initContainers: - name: init-example image: busybox
BinitContainers: - name: init-example image: busybox containers: - name: app image: nginx
Cinit: - name: init-example image: busybox containers: - name: app image: nginx
Dcontainers: - name: app image: nginx init: - name: init-example image: busybox
Step-by-Step Solution
Solution:
  1. Step 1: Recall Kubernetes Pod spec structure

    Init containers are defined under the initContainers field, separate from containers.
  2. Step 2: Identify correct syntax

    initContainers: - name: init-example image: busybox containers: - name: app image: nginx correctly places initContainers before containers with proper indentation and keys.
  3. Final Answer:

    initContainers: - name: init-example image: busybox containers: - name: app image: nginx -> Option B
  4. Quick Check:

    Init containers use 'initContainers' key [OK]
Quick Trick: Use 'initContainers' key, not 'init' [OK]
Common Mistakes:
  • Using 'init' instead of 'initContainers'
  • Placing init container inside 'containers' list
  • Incorrect indentation or YAML structure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes