Bird
0
0

Given the following Kubernetes YAML snippet, what will be the result of applying it?

medium📝 Command Output Q13 of 15
Kubernetes - Advanced Deployment Patterns
Given the following Kubernetes YAML snippet, what will be the result of applying it?
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deploy
spec:
  replicas: 2
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: test-container
        image: nginx:1.19
        ports:
        - containerPort: 80
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
ADeployment will create 3 pods permanently due to maxSurge setting.
BDeployment will create 2 pods with rolling update allowing 1 extra pod during updates.
CDeployment will fail because maxUnavailable cannot be zero.
DDeployment will create only 1 pod because maxUnavailable is zero.
Step-by-Step Solution
Solution:
  1. Step 1: Understand replicas and rolling update settings

    The deployment requests 2 replicas. maxSurge: 1 allows 1 extra pod temporarily during updates, maxUnavailable: 0 means no pods go down during update.
  2. Step 2: Analyze the effect on pod count

    During rolling update, Kubernetes can create up to 3 pods (2 + 1 surge) temporarily, but final stable state is 2 pods running.
  3. Final Answer:

    Deployment will create 2 pods with rolling update allowing 1 extra pod during updates. -> Option B
  4. Quick Check:

    maxSurge=1 means 1 extra pod allowed temporarily [OK]
Quick Trick: maxSurge adds temporary pods, doesn't increase final replicas [OK]
Common Mistakes:
  • Thinking maxSurge adds permanent pods
  • Believing maxUnavailable cannot be zero
  • Confusing maxUnavailable with pod count

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes