0
0
Kubernetesdevops~20 mins

Blue-green deployments in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Blue-Green Deployment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Blue-Green Deployment Basics

What is the primary benefit of using a blue-green deployment strategy in Kubernetes?

AIt provides automatic rollback on pod failure without manual intervention.
BIt allows zero downtime by switching traffic between two identical environments.
CIt automatically scales pods based on CPU usage.
DIt reduces the number of pods running to save resources.
Attempts:
2 left
💡 Hint

Think about how traffic is managed during updates.

💻 Command Output
intermediate
1:30remaining
Identifying Active Service in Blue-Green Deployment

You have two deployments named app-blue and app-green. The Kubernetes service app-service currently routes traffic to app-green. What is the output of this command?

kubectl get endpoints app-service -o jsonpath='{.subsets[*].addresses[*].targetRef.name}'
Aapp-green
Bapp-blue
Capp-service
DNo output (empty string)
Attempts:
2 left
💡 Hint

The service routes traffic to the currently active deployment pods.

Configuration
advanced
2:00remaining
Correcting Service Selector for Blue-Green Switch

You want to switch traffic from app-blue to app-green by updating the service selector. Which of the following kubectl patch commands correctly updates the service selector to point to app=green?

Akubectl patch service app-service -p '{"spec":{"ports":[{"app":"green"}]}}'
Bkubectl patch service app-service -p '{"metadata":{"labels":{"app":"green"}}}'
Ckubectl patch service app-service -p '{"spec":{"selector":{"app":"green"}}}'
Dkubectl patch service app-service -p '{"spec":{"selector":{"app":"blue"}}}'
Attempts:
2 left
💡 Hint

Service selectors are under spec.selector.

🔀 Workflow
advanced
2:30remaining
Blue-Green Deployment Traffic Switch Steps

Arrange the steps in the correct order to perform a blue-green deployment traffic switch in Kubernetes.

A1,3,2,4
B1,2,3,4
C3,1,2,4
D2,1,3,4
Attempts:
2 left
💡 Hint

Think about deploying, verifying, switching traffic, then cleaning up.

Troubleshoot
expert
2:30remaining
Troubleshooting Traffic Not Switching in Blue-Green Deployment

After updating the service selector to app=green, users still reach the old version app-blue. What is the most likely cause?

AThe Kubernetes cluster needs to be restarted to apply changes.
BThe service selector was updated but the DNS cache on clients still points to old pods.
CThe service ports were changed and do not match pod ports.
DThe <code>app-green</code> pods are not ready or failing readiness probes.
Attempts:
2 left
💡 Hint

Consider pod readiness and how Kubernetes routes traffic.