Courseiva
Application Deployment →hardMultiple Choice

CKAD Application Deployment Practice Question

You are asked to implement a blue-green deployment using Kubernetes Deployments and Services. You have a blue Deployment with label 'version: blue' and a green Deployment with label 'version: green'. Both have selector 'app: myapp'. You need a Service that initially points to blue. How should you configure the Service to switch to green without downtime?

⚠ Common exam trap

Watch out — candidates often think they must delete and recreate the Service to change its selector, not realizing that Kubernetes allows live updates to the selector field without downtime.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Update the Service's label selector to 'app: myapp, version: green'

Updating the Service's label selector to 'app: myapp, version: green' causes the Service to immediately route traffic to green pods without any downtime. The Service uses the selector to dynamically discover pods with matching labels, so changing the selector seamlessly shifts traffic to the green Deployment while the blue Deployment remains untouched.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Change the blue Deployment's pod label to 'version: green' and delete green Deployment

    Why it's wrong here

    Changing the blue Deployment's pod labels to version:green violates the Deployment's immutable selector, which must always match its pod template, so the API server will reject the update or trigger an invalid rollout. Even if it were allowed, both Deployments would produce pods with identical labels, making the Service match both groups, and deleting the green Deployment would simply leave blue pods mislabeled rather than performing a controlled traffic switch.

  • ✓

    Update the Service's label selector to 'app: myapp, version: green'

    Why this is correct

    Updating the Service's label selector to 'app: myapp, version: green' is the canonical blue-green switch: the Endpoints controller immediately recalculates the endpoint set to include only green pods, so new traffic flows to green while blue receives no new connections. Because this is a single atomic change (e.g., kubectl patch), there is zero downtime, and the blue Deployment remains intact for instant rollback if green fails.

  • ✗

    Delete the Service and recreate it with the new selector

    Why it's wrong here

    Deleting and recreating the Service introduces a window where no Service object exists, causing the ClusterIP to be unallocated and client connections to fail. Furthermore, a newly created Service is assigned a new ClusterIP (the old IP cannot be reassigned in most clusters), which breaks clients that cached the previous IP—whereas a selector update preserves the ClusterIP and only changes routing.

  • ✗

    Update the Service's cluster IP to point to green pods

    Why it's wrong here

    The Service's clusterIP field is immutable; any attempt to update it is rejected by the API server because the IP is allocated at creation time and must remain stable for clients and Endpoints. Even conceptually, clusterIP does not 'point to' pods directly—it is a virtual IP used by kube-proxy, and actual pod routing is determined entirely by the label selector, so modifying that selector is the only valid way to reroute to green.

About these practice questions

Courseiva writes every CKAD question from scratch — 826 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKAD practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKAD exam.