0
0
Kubernetesdevops~20 mins

Canary deployments in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Canary Deployment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the main purpose of a canary deployment in Kubernetes?

Choose the best explanation for why teams use canary deployments.

ATo gradually roll out changes to a small subset of users before full deployment
BTo immediately replace all running pods with new ones without testing
CTo create a backup of the current deployment before updating
DTo run multiple versions of an application permanently for load balancing
Attempts:
2 left
💡 Hint

Think about minimizing risk when releasing new software.

💻 Command Output
intermediate
2:00remaining
What is the output of this kubectl command during a canary deployment?

Given the command below, what will it show?

Kubernetes
kubectl get pods -l app=myapp
ALists all pods with label app=myapp including both stable and canary versions
BShows only pods running the stable version of myapp
CShows only pods running the canary version of myapp
DReturns an error because label selector is missing
Attempts:
2 left
💡 Hint

Label selectors filter pods by matching labels.

Configuration
advanced
3:00remaining
Which Kubernetes manifest snippet correctly defines a canary deployment with 10% traffic?

Choose the manifest snippet that sets up a canary deployment routing 10% of traffic to the new version.

A
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: myapp-ingress
spec:
  rules:
  - host: myapp.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: myapp-canary
            port:
              number: 80
B
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp-canary
spec:
  replicas: 10
  selector:
    matchLabels:
      app: myapp
      version: canary
  template:
    metadata:
      labels:
        app: myapp
        version: canary
    spec:
      containers:
      - name: myapp
        image: myapp:v2
C
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: myapp
spec:
  hosts:
  - myapp.example.com
  http:
  - route:
    - destination:
        host: myapp
        subset: stable
      weight: 90
    - destination:
        host: myapp
        subset: canary
      weight: 10
D
apiVersion: v1
kind: Service
metadata:
  name: myapp
spec:
  selector:
    app: myapp
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8080
Attempts:
2 left
💡 Hint

Look for traffic splitting configuration in the manifest.

Troubleshoot
advanced
3:00remaining
Why does the canary deployment not receive any traffic despite correct configuration?

You configured a canary deployment with 10% traffic but the canary pods show zero requests. What is the most likely cause?

AThe ingress controller is not installed in the cluster
BThe canary pods are not running due to image pull errors
CThe stable deployment has zero replicas
DThe service selector does not include the canary pods' labels
Attempts:
2 left
💡 Hint

Check if traffic routing matches pod labels correctly.

🔀 Workflow
expert
3:00remaining
What is the correct sequence of steps for a safe canary deployment in Kubernetes?

Order the steps below to perform a safe canary deployment.

A1,3,2,4
B1,2,3,4
C2,1,3,4
D1,4,3,2
Attempts:
2 left
💡 Hint

Think about deploying first, then monitoring, then increasing traffic, then full rollout.