Bird
0
0

Which of the following is the correct syntax to specify the container image in a Deployment YAML?

easy📝 Syntax Q3 of 15
Kubernetes - ReplicaSets and Deployments
Which of the following is the correct syntax to specify the container image in a Deployment YAML?
Acontainers: - name: app image: nginx:latest
Bcontainers: - image: nginx:latest name: app
Ccontainer: name: app image: nginx:latest
Dcontainers: name: app image: nginx:latest
Step-by-Step Solution
Solution:
  1. Step 1: Check correct container list syntax

    The containers field is a list indicated by a dash (-). Each container must have a name and image.
  2. Step 2: Validate correct order and keys

    containers: - name: app image: nginx:latest correctly uses a list with dash, name first, then image. containers: - image: nginx:latest name: app reverses keys but is valid YAML; however, Kubernetes expects name first by convention. Options C and D have syntax errors (missing list or wrong key).
  3. Final Answer:

    containers: - name: app image: nginx:latest -> Option A
  4. Quick Check:

    Container list uses dash and name/image keys [OK]
Quick Trick: Use dash (-) for containers list with name and image keys [OK]
Common Mistakes:
  • Missing dash for list items
  • Using singular container instead of containers
  • Incorrect indentation or key order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes