Bird
0
0

Given this snippet of a Kubernetes Deployment YAML for canary rollout, what percentage of traffic will go to the canary pods?

medium📝 Command Output Q13 of 15
Kubernetes - Advanced Deployment Patterns
Given this snippet of a Kubernetes Deployment YAML for canary rollout, what percentage of traffic will go to the canary pods?
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp-canary
  labels:
    version: canary
spec:
  replicas: 2
  selector:
    matchLabels:
      app: myapp
      version: canary
  template:
    metadata:
      labels:
        app: myapp
        version: canary
    spec:
      containers:
      - name: myapp
        image: myapp:v2
Assuming the stable deployment has 8 replicas with label version: stable and the Service routes traffic evenly by label.
A20%
B25%
C80%
D50%
Step-by-Step Solution
Solution:
  1. Step 1: Calculate total replicas

    Stable has 8 replicas, canary has 2 replicas, total = 8 + 2 = 10 replicas.
  2. Step 2: Calculate canary traffic percentage

    Traffic is split evenly by label, so canary gets 50% traffic regardless of pod count.
  3. Final Answer:

    50% -> Option D
  4. Quick Check:

    Service splits traffic evenly by label = 50% canary [OK]
Quick Trick: Check how Service splits traffic: by pods or labels [OK]
Common Mistakes:
  • Assuming traffic splits by pod count instead of labels
  • Ignoring label-based routing in Service
  • Miscounting total replicas

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes