Bird
0
0

Which of the following is the correct syntax to define a Kubernetes Deployment with a rolling update strategy?

easy📝 Configuration Q12 of 15
Kubernetes - Advanced Deployment Patterns
Which of the following is the correct syntax to define a Kubernetes Deployment with a rolling update strategy?
AapiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: myapp\nspec:\n strategy:\n type: RollingUpdate\n replicas: 3
BapiVersion: v1\nkind: Deployment\nmetadata:\n name: myapp\nspec:\n strategy:\n type: Recreate\n replicas: 3
CapiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: myapp\nspec:\n strategy:\n rollingUpdate:\n maxSurge: 1\n maxUnavailable: 0\n replicas: 3
DapiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: myapp\nspec:\n replicas: 3
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct apiVersion and kind

    Deployments use apiVersion 'apps/v1' and kind 'Deployment'. Options A, C, and D use this correctly.
  2. Step 2: Check strategy type for rolling update

    RollingUpdate strategy requires 'strategy.type: RollingUpdate' as in apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: myapp\nspec:\n strategy:\n type: RollingUpdate\n replicas: 3. apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: myapp\nspec:\n strategy:\n rollingUpdate:\n maxSurge: 1\n maxUnavailable: 0\n replicas: 3 misses 'type' field, so it's incomplete.
  3. Final Answer:

    apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: myapp\nspec:\n strategy:\n type: RollingUpdate\n replicas: 3 -> Option A
  4. Quick Check:

    RollingUpdate strategy syntax = apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: myapp\nspec:\n strategy:\n type: RollingUpdate\n replicas: 3 [OK]
Quick Trick: Look for 'strategy.type: RollingUpdate' in spec [OK]
Common Mistakes:
  • Using wrong apiVersion for Deployment
  • Missing 'type' under strategy for rolling update
  • Confusing Recreate with RollingUpdate strategy

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes