Bird
0
0

Which of the following is the correct way to define multiple containers inside a single Pod YAML spec?

easy📝 Configuration Q12 of 15
Kubernetes - Pods
Which of the following is the correct way to define multiple containers inside a single Pod YAML spec?
Acontainers: [{name: 'app', image: 'app-image'}, {name: 'sidecar', image: 'sidecar-image'}]
Bcontainer: [{name: 'app', image: 'app-image'}, {name: 'sidecar', image: 'sidecar-image'}]
Ccontainers: {name: 'app', image: 'app-image', name: 'sidecar', image: 'sidecar-image'}
Dpods: [{name: 'app', image: 'app-image'}, {name: 'sidecar', image: 'sidecar-image'}]
Step-by-Step Solution
Solution:
  1. Step 1: Recall Pod spec syntax

    The Pod spec uses a key 'containers' with a list of container objects.
  2. Step 2: Validate options

    containers: [{name: 'app', image: 'app-image'}, {name: 'sidecar', image: 'sidecar-image'}] correctly uses 'containers' as a list. The other options use wrong keys or wrong data structures.
  3. Final Answer:

    containers: [{name: 'app', image: 'app-image'}, {name: 'sidecar', image: 'sidecar-image'}] -> Option A
  4. Quick Check:

    Multiple containers use 'containers' list = A [OK]
Quick Trick: Use 'containers' key with a list for multiple containers [OK]
Common Mistakes:
  • Using 'container' instead of 'containers'
  • Using curly braces instead of list for multiple containers
  • Confusing 'pods' key with 'containers'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes