Courseiva
Application Deployment →hardMultiple Choice

CKAD Application Deployment Practice Question

You are implementing a canary deployment for a microservice named 'api'. The stable version is deployed as 'api-stable' with label 'version: stable'. You create a canary Deployment 'api-canary' with label 'version: canary'. Both Deployments have the same label 'app: api'. You want a Service 'api-svc' to route 90% of traffic to stable and 10% to canary. Which Service configuration achieves this?

⚠ Common exam trap

A common mix-up: candidates think annotations or custom selectors can control traffic weight, but Kubernetes Services only distribute traffic proportionally to the number of ready Pods matching the selector.

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

✓

selector: {app: api} and adjust the number of replicas in each Deployment to achieve the desired ratio (e.g., 9 stable, 1 canary)

Kubernetes Services distribute traffic based on the number of ready Pods matching the selector. By setting 9 replicas for 'api-stable' and 1 replica for 'api-canary', both with the same selector 'app: api', the Service will route approximately 90% of requests to stable and 10% to canary, achieving the desired canary deployment ratio without native traffic splitting.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Add annotation 'traffic-weight: 90' to stable and 'traffic-weight: 10' to canary

    Why it's wrong here

    Adding an annotation such as 'traffic-weight: 90' to a Deployment is ineffective because annotations are arbitrary key-value metadata that Kubernetes stores for tooling and organizational purposes; they are never read by kube-proxy, the Service controller, or the endpoints controller to influence traffic routing. Even if both Deployments carry these annotations, the Service's selector will continue to include all matching pods equally, and traffic distribution will remain strictly uniform across the available endpoints, not proportional to any annotation value. To shift traffic based on metadata you would need an external controller (e.g., a service mesh like Istio, or an ingress controller with canary support) that actively interprets that metadata and manipulates routing rules.

  • ✓

    selector: {app: api} and adjust the number of replicas in each Deployment to achieve the desired ratio (e.g., 9 stable, 1 canary)

    Why this is correct

    Using a single Service with the broad selector `app: api` is the correct native Kubernetes approach because it makes the Service's Endpoints object include pods from both the stable and canary Deployments simultaneously. The kube-proxy component (or the in-cluster DNS/round-robin mechanism) then picks endpoints for each new connection uniformly, so the fraction of traffic each version receives is directly proportional to the number of ready pods it contributes—for 9 stable and 1 canary pod, roughly 90% of connections go to stable and 10% to canary. This ratio can be tuned by scaling the `replicas` field in each Deployment, but you cannot get fine-grained percentages because each pod is an equal unit and there is no weighting factor beyond pod count.

  • ✗

    selector: {app: api, version: stable}

    Why it's wrong here

    Setting the Service selector to `{app: api, version: stable}` will make the Service's Endpoints object contain only the Pods that carry both the `app=api` and `version=stable` labels. Because the canary Pods are labeled with `version=canary` (or any other value), they will not match this selector, so they will be excluded from the Endpoints list and will receive zero traffic from this Service. This effectively disables the canary deployment from a routing perspective; all connections will go exclusively to the stable version, which is the opposite of the intended canary rollout behavior.

  • ✗

    Create two separate Services, each targeting one version, and rely on DNS weighting

    Why it's wrong here

    Creating two separate Services (one for stable, one for canary) and relying on DNS weighting does not work because Kubernetes' built-in DNS (CoreDNS/kube-dns) returns all matching clusterIPs, and the default policy is round-robin only when multiple IPs answer for the same name—but each Service has its own distinct DNS name and its own clusterIP, so no weighting is applied. Even if you gave both Services the same name (which is impossible in the same namespace) or relied on external DNS, Kubernetes itself provides no native DNS weighting mechanism to send a percentage of queries to one Service and the rest to another. A service mesh or an ingress controller with weighted routing (e.g., Istio VirtualService, Flagger) is required to implement percentage-based split across two distinct Services.

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.