Bird
0
0

You want to create a Deployment that runs 3 replicas of a pod with two containers: one running nginx and another running a logging sidecar. Which YAML snippet correctly defines the containers section?

hard📝 Workflow Q8 of 15
Kubernetes - ReplicaSets and Deployments
You want to create a Deployment that runs 3 replicas of a pod with two containers: one running nginx and another running a logging sidecar. Which YAML snippet correctly defines the containers section?
Acontainers: name: nginx image: nginx:latest name: logger image: busybox command: ['sh', '-c', 'tail -f /var/log/nginx/access.log']
Bcontainer: - name: nginx image: nginx:latest - name: logger image: busybox command: ['sh', '-c', 'tail -f /var/log/nginx/access.log']
Ccontainers: - name: nginx image: nginx:latest - name: logger image: busybox command: ['sh', '-c', 'tail -f /var/log/nginx/access.log']
Dcontainers: - nginx: latest - logger: busybox
Step-by-Step Solution
Solution:
  1. Step 1: Verify containers list syntax

    Containers must be a list with dash (-) items, each with name and image keys.
  2. Step 2: Check command syntax for sidecar

    containers: - name: nginx image: nginx:latest - name: logger image: busybox command: ['sh', '-c', 'tail -f /var/log/nginx/access.log'] correctly defines two containers with proper keys and command array for the logger sidecar.
  3. Final Answer:

    containers: - name: nginx image: nginx:latest - name: logger image: busybox command: ['sh', '-c', 'tail -f /var/log/nginx/access.log'] -> Option C
  4. Quick Check:

    Multiple containers need list with name and image [OK]
Quick Trick: List multiple containers with dash and name/image keys [OK]
Common Mistakes:
  • Using singular 'container' key
  • Missing dash for list items
  • Incorrect command syntax in YAML

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes