Courseiva

CCNA Ckad Deployment Questions

75 of 163 questions · Page 1/3 · Ckad Deployment topic · Answers revealed

1
MCQmedium

You have a Deployment with 'replicas: 3' and the HPA is configured with 'targetCPUUtilizationPercentage: 80'. The current CPU usage is at 60% across all pods, but the HPA has scaled up to 5 replicas. What is the most likely reason?

A.The CPU request in the Deployment's resource spec might be set lower than expected, causing the HPA to perceive higher utilization.
B.The HPA has a behavior policy that scales up aggressively
C.The HPA is using the 'averageUtilization' target type on a custom metric, not CPU
D.The HPA is reading the total CPU usage instead of average
AnswerA

If the container's resource requests are set lower than actual usage, the utilization percentage can be higher. For example, if request is 100m but usage is 200m, utilization is 200% even if absolute CPU is low. This could trigger scaling.

Why this answer

The HPA calculates CPU utilization as the average CPU usage across all pods divided by the CPU request of each pod. If the Deployment's container resource requests are set to a value that is lower than expected (e.g., 0.5 CPU instead of 1.0 CPU), then the same absolute CPU usage results in a higher utilization percentage. With 3 pods at 60% actual usage but a low CPU request, the utilization relative to the request could exceed the 80% target, triggering scale-up to 5 replicas.

Therefore, option A is the most likely reason: a mismatch in the CPU request on the Deployment's resource spec causes the HPA to perceive higher utilization.

2
MCQeasy

Which command scales a Deployment named 'web' to 5 replicas?

A.kubectl set replicas deployment web 5
B.kubectl scale deployment web --replicas=5
C.kubectl resize deployment web --replicas=5
D.kubectl autoscale deployment web --replicas=5
AnswerB

This is the canonical imperative command to manually change the DesiredReplicas field of a deployment. `kubectl scale` works on deployments, replication controllers, replica sets, and stateful sets, and the `--replicas=` flag explicitly sets the target count. It is the correct way to immediately scale a deployment without altering any other spec.

Why this answer

The correct command to scale a Deployment to a specific number of replicas is `kubectl scale deployment web --replicas=5`. This command directly modifies the `spec.replicas` field of the Deployment object, instructing the Kubernetes controller manager to adjust the number of running Pods to match the desired count.

Exam trap

The trap here is that candidates confuse `kubectl scale` (which sets a static replica count) with `kubectl autoscale` (which creates an HPA for dynamic scaling), or they invent non-existent commands like `kubectl set replicas` or `kubectl resize`.

How to eliminate wrong answers

Option A is wrong because `kubectl set replicas` is not a valid kubectl command; the correct verb is `scale`, not `set`. Option C is wrong because `kubectl resize` does not exist in kubectl; scaling is performed via the `scale` subcommand. Option D is wrong because `kubectl autoscale` creates a HorizontalPodAutoscaler (HPA) that dynamically adjusts replicas based on metrics, not a static replica count; it requires a target metric (e.g., CPU utilization) and does not directly set replicas to 5.

3
MCQmedium

You are performing a rolling update of a Deployment. You set maxSurge=2 and maxUnavailable=1. The Deployment has 5 replicas. During the update, how many pods can be running simultaneously?

A.7
B.6
C.10
D.5
AnswerA

7 is correct because during a rolling update with a desired replica count of 5 and a maxSurge set to 2, Kubernetes is allowed to create up to 2 additional pods above the desired count. This surge capacity means the absolute maximum number of pods that can be running simultaneously is 5 + 2 = 7. The deployment controller uses this headroom to bring up new pods before terminating old ones, ensuring zero downtime and a smooth transition.

Why this answer

During a rolling update, maxSurge=2 allows up to 2 extra pods beyond the desired replicas, and maxUnavailable=1 allows at most 1 pod to be unavailable. With a desired count of 5, the maximum running pods is 5 (desired) + 2 (surge) = 7, because the surge pods are created before old ones are terminated, and the unavailable limit does not cap the total running count.

Exam trap

The trap here is that candidates often confuse maxUnavailable as a cap on total running pods, when in fact it only limits how many pods can be in a non-running state (e.g., terminating or pending), while maxSurge independently controls the extra pods above the desired count.

How to eliminate wrong answers

Option B (6) is wrong because it underestimates the surge capacity; maxSurge=2 adds 2 extra pods, not 1. Option C (10) is wrong because it incorrectly assumes maxSurge and maxUnavailable are additive limits on total pods, but maxUnavailable caps unavailable pods, not total running pods. Option D (5) is wrong because it ignores the maxSurge setting entirely, treating the update as if no extra pods are allowed.

4
MCQeasy

You have a Deployment with the following strategy: type: Recreate. What happens when you update the pod template?

A.Old pods are terminated first, then new pods are created
B.New pods are created first, then old pods are terminated
C.Pods are updated in-place without termination
D.The update is rejected because Recreate is not a valid strategy
AnswerA

In a Recreate strategy, the Deployment controller first scales the old ReplicaSet down to zero and waits for all old pods to terminate completely. Only after a clean shutdown does it create the new ReplicaSet and its pods. This guarantees that no two versions of the application ever run concurrently, but it intentionally introduces downtime during the transition.

Why this answer

The Recreate strategy in a Kubernetes Deployment first terminates all existing Pods before creating new ones. When the pod template is updated, the Deployment controller scales down the ReplicaSet to 0 replicas, waits for all Pods to terminate, then scales up the new ReplicaSet to the desired number of replicas. This ensures zero overlap between old and new Pods, which is useful for workloads that cannot run concurrently.

Exam trap

The trap here is that candidates confuse Recreate with RollingUpdate, assuming new Pods are always created first to minimize downtime, but Recreate deliberately sacrifices availability for safety by terminating all old Pods before starting new ones.

How to eliminate wrong answers

Option B is wrong because it describes the RollingUpdate strategy, where new Pods are created first and old Pods are terminated gradually to maintain availability. Option C is wrong because Kubernetes Pods are immutable; updates to the pod template always require Pod recreation, not in-place updates. Option D is wrong because Recreate is a valid and documented Deployment strategy type in Kubernetes, explicitly supported in the apps/v1 API.

5
MCQhard

You are using Kustomize with a base and an overlay. The base sets a Deployment's replicas to 3. The overlay sets replicas to 5 using a patch. What is the final replica count after running 'kubectl apply -k overlay/'?

A.5
B.The result depends on the merge order
C.8
D.3
AnswerA

Kustomize's overlay patches are applied on top of the base after the base is fully rendered. A patch that sets replicas to 5 will replace the base's value of 3, because overlays are designed to be the final authority for customized values. The kustomize build output therefore contains the patched field, not the base's original value, making 5 the correct and deterministic result.

Why this answer

In Kustomize, overlays override base values through patches. The overlay specifies replicas: 5, so the final replica count is 5. Thus, option A is correct.

Option B is incorrect because Kustomize applies patches in a defined order, not a random merge. Option C is incorrect because values are not summed. Option D is the base value, which is overridden.

6
MCQeasy

Which Helm command installs a chart from a repository?

A.helm deploy <release-name> <chart>
B.helm install <release-name> <chart>
C.helm create <release-name> <chart>
D.helm run <release-name> <chart>
AnswerB

helm install <release-name> <chart> is the correct command to create a Helm release from a chart source. The chart argument can be a repository reference like 'bitnami/nginx', a local directory path, a packaged .tgz file, or a URL. Executing this command renders the chart's templates with the default values and applies them to the cluster, registering the release so that later upgrades or rollbacks can be performed via `helm upgrade` and `helm rollback`.

Why this answer

The correct command to deploy a chart from a repository is `helm install <release-name> <chart>`. This command tells Helm to create a release (a running instance of a chart) using the specified chart name or chart reference, which can be a chart from a configured repository, a local path, or a packaged chart archive.

Exam trap

The trap here is that candidates may confuse `helm install` with other common verbs like `deploy` or `run`, or mistakenly think `helm create` installs a chart, when in fact `helm create` only generates a chart template.

How to eliminate wrong answers

Option A is wrong because `helm deploy` is not a valid Helm command; the correct verb for installing a chart is `install`, not `deploy`. Option C is wrong because `helm create` is used to scaffold a new chart directory structure locally, not to install a chart from a repository. Option D is wrong because `helm run` is not a valid Helm command; Helm does not have a `run` subcommand for chart installation.

7
MCQmedium

You have installed a Helm chart for 'wordpress' using 'helm install my-wordpress bitnami/wordpress'. Later, you want to check the status of the release. Which command lists the status of all releases?

A.helm list
B.helm status my-wordpress
C.helm history my-wordpress
D.helm show status
AnswerA

`helm list` is the correct command here because it enumerates every Helm release installed in the current namespace, displaying each release's name, status, chart version, app version, and revision number. It also indicates whether a release is deployed, failed, pending, or uninstalled, giving a concise overview similar to how `kubectl get pods` lists pods. Since you installed a WordPress chart via Helm, running `helm list` will confirm that the release exists and show its current lifecycle state.

Why this answer

The `helm list` command is the correct way to list all releases in the current namespace, showing their status (deployed, failed, pending, etc.). It provides a summary of each release, including the name, revision, update time, and status. This directly answers the question of listing the status of all releases.

Exam trap

A common pitfall is confusing commands that operate on a single release (like `helm status` or `helm history`) with the command that lists all releases (`helm list`). Candidates may also invent non-existent commands like `helm show status`.

How to eliminate wrong answers

Option B is wrong because `helm status my-wordpress` shows the detailed status of a single, specific release (my-wordpress), not all releases. Option C is wrong because `helm history my-wordpress` displays the revision history (rollback points) for a specific release, not the current status of all releases. Option D is wrong because `helm show status` is not a valid Helm command; `helm show` is used for chart information (e.g., `helm show chart`, `helm show values`), not release status.

8
MCQmedium

Which kubectl command can you use to pause a rolling update of a Deployment?

A.kubectl rollout pause deployment/my-deployment
B.kubectl rollout suspend deployment/my-deployment
C.kubectl rollout stop deployment/my-deployment
D.kubectl rollout halt deployment/my-deployment
AnswerA

`kubectl rollout pause deployment/my-deployment` is the correct command because it updates the Deployment's `.spec.paused` field to `true`, signaling the deployment controller to stop progressing the current rollout. The running Pods and existing ReplicaSets remain untouched, but any template changes you've made are held back until you run `kubectl rollout resume`. This gives you a controlled window to verify or modify configuration mid-stream.

Why this answer

The correct command to pause a rolling update of a Deployment is `kubectl rollout pause deployment/my-deployment`. This command temporarily halts the rollout process, allowing you to make changes or investigate issues without triggering a new revision. The `kubectl rollout` subcommand is specifically designed for managing Deployment rollouts, and `pause` is the correct verb to suspend the update.

Exam trap

The CKAD exam often tests the distinction between `pause` and `suspend` or `stop`, expecting candidates to know that `kubectl rollout pause` is the only valid command for temporarily halting a rolling update.

How to eliminate wrong answers

Option B is wrong because `kubectl rollout suspend` is not a valid kubectl command; the correct verb for pausing a rollout is `pause`, not `suspend`. Option C is wrong because `kubectl rollout stop` does not exist; stopping a rollout is done with `kubectl rollout undo` to roll back to a previous revision. Option D is wrong because `kubectl rollout halt` is not a valid kubectl command; Kubernetes uses `pause` and `resume` for controlling rollout progress.

9
MCQhard

A developer wants to perform a canary deployment where 10% of traffic goes to a new version (v2) of an application. They create two Deployments (app-v1 and app-v2) and a Service. The Service selector is configured to match labels: 'app: myapp, version: v1'. How can they route 10% of traffic to v2 with minimal changes?

A.Use kubectl rollout pause on the v2 Deployment.
B.Set the v2 Deployment's spec.replicas to 10% of the total replicas and keep the Service selector unchanged.
C.Change the Service selector to 'app: myapp' (remove version label) and set v1 replicas to 9 and v2 replicas to 1.
D.Add a NetworkPolicy to limit traffic to v2 pods to 10%.
AnswerC

This works because removing the version label from the Service selector makes it match every pod labeled app: myapp, including both v1 and v2. With v1 replicas=9 and v2 replicas=1, the Service sees 10 ready endpoints, and the default load-balancing behavior sends roughly one-tenth of requests to v2. This replica ratio is the standard lightweight canary technique for a single Service, as long as both Deployments share the same app label and no other version-specific selector remains.

Why this answer

To achieve a canary deployment with 10% traffic to v2, the Service selector must match pods from both versions. By changing the selector to 'app: myapp' (removing the version label), the Service will load-balance across all pods with that label. Then, by setting v1 replicas to 9 and v2 replicas to 1, the total pods are 10, so v2 receives approximately 10% of traffic.

This requires minimal changes: one selector update and replica adjustments.

Exam trap

CKAD often tests the misconception that changing replica counts alone can route traffic to a new version when the Service selector still filters by version label, leading candidates to overlook the need to modify the selector.

How to eliminate wrong answers

Option A is wrong because pausing a Deployment only stops rolling updates; it does not affect traffic routing, and the Service selector still points only to v1, so v2 receives no traffic. Option B is wrong because setting v2 replicas to 10% while keeping the Service selector unchanged means the Service still selects only v1 pods (due to the version label), so v2 gets zero traffic. Option D is wrong because NetworkPolicy controls network access based on IP addresses and ports, not traffic splitting by percentage; it cannot route a specific proportion of traffic to a version.

10
MCQmedium

A company wants to deploy a stateful database on Kubernetes. The database requires stable network identities and persistent storage per pod. Which resource should be used?

A.Job
B.StatefulSet
C.Deployment
D.DaemonSet
AnswerB

StatefulSet is the correct controller because it gives each pod a stable ordinal identity (e.g., db-0, db-1) and stable, dedicated PersistentVolumeClaims via volumeClaimTemplates. It supports ordered startup, shutdown, and scaling, which is critical for database clustering and failover. The stable network DNS names enable database nodes to discover and communicate with each other reliably across rescheduling. Thus, it matches the requirements of a stateful database deployment.

Why this answer

StatefulSet is the correct resource because it provides stable, unique network identities (via headless Services and ordinal pod names like `db-0`, `db-1`) and persistent storage per pod (via PersistentVolumeClaims that are retained across rescheduling). This matches the requirement for a stateful database where each pod must maintain its identity and data independently.

Exam trap

The trap here is that candidates often choose Deployment because they associate it with scaling and rolling updates, but they overlook the critical need for stable network identities and per-pod persistent storage, which only StatefulSet provides.

How to eliminate wrong answers

Option A is wrong because a Job is designed for batch processing or one-off tasks, not for long-running stateful workloads that require stable identities and persistent storage. Option C is wrong because a Deployment creates pods with random, ephemeral names and does not guarantee stable network identities or per-pod persistent storage; it is suited for stateless applications. Option D is wrong because a DaemonSet ensures one pod per node, typically for node-level services like logging or monitoring, and does not provide ordered deployment, stable identities, or per-pod persistent storage for a database.

11
MCQmedium

You have a Deployment with replicas: 5 and update strategy type: RollingUpdate with maxSurge: 25% and maxUnavailable: 25%. During a rolling update, what is the maximum number of pods that can be unavailable at any given time?

A.2
B.5
C.1
D.0
AnswerC

Correct. The maxUnavailable value is derived by taking 25% of the desired replicas: 0.25 × 5 = 1.25. Since the number of pods must be an integer, Kubernetes rounds this up to 1, ensuring at most one pod is unavailable at a time. This leaves at least 4 replicas running throughout the update, matching the configured tolerance.

Why this answer

With maxUnavailable: 25% on a Deployment of 5 replicas, the maximum number of unavailable pods is 25% of 5 = 1.25, and Kubernetes rounds down for maxUnavailable, resulting in 1. Therefore, at most 1 pod can be unavailable at any given time during the rolling update.

Exam trap

The trap here is that candidates often round 25% of 5 (1.25) to 2 instead of 1, forgetting that Kubernetes rounds down for maxUnavailable and rounds up for maxSurge, leading to incorrect answers like option A.

How to eliminate wrong answers

Option A is wrong because 2 would be the result if 25% of 5 were rounded up (1.25 → 2), but Kubernetes rounds down for maxUnavailable, so the correct value is 1. Option B is wrong because 5 represents the total number of replicas, not the maximum unavailable pods; maxUnavailable limits how many can be down simultaneously, not the total count. Option D is wrong because 0 would imply no pods can be unavailable during the update, which contradicts the rolling update strategy that allows some pods to be taken down gradually; maxUnavailable: 25% explicitly permits a portion to be unavailable.

12
MCQhard

Which of the following is a correct Kustomize kustomization.yaml configuration for setting an image tag to 'v2'?

A.images: - name: my-app newName: v2
B.images: - name: my-app newTag: v2
C.patches: - target: kind: Deployment patch: |- - op: replace path: /spec/template/spec/containers/0/image value: my-app:v2
D.imageTag: - name: my-app tag: v2
AnswerB

The `images` field with `newTag` is the purpose-built transformer for overriding container image tags in Kustomize. It preserves the original image name and replaces only the tag with the specified value, making it the simplest and most declarative way to pin a new version across all matching containers. This is why this option is the correct answer.

Why this answer

In Kustomize, the `images` field in `kustomization.yaml` uses the `newTag` key to override the tag of an existing container image. This allows you to change the image tag to 'v2' without modifying the original YAML manifests, aligning with Kustomize's declarative patching approach.

Exam trap

The CKAD exam often tests the distinction between `newName` and `newTag` in Kustomize, trapping candidates who confuse the two or assume `newName` can set a tag, or who overcomplicate the solution with JSON patches when a simpler built-in field exists.

How to eliminate wrong answers

Option A is wrong because `newName` is used to change the image name (e.g., from 'my-app' to 'my-app2'), not the tag; using it to set a tag like 'v2' would incorrectly replace the image name. Option C is wrong because it uses a JSON Patch (RFC 6902) with `op: replace` to directly modify the Deployment manifest, which is a valid but non-Kustomize-native approach; Kustomize's `images` field is the idiomatic way to set image tags, and this patch would work but is not a `kustomization.yaml` configuration for setting an image tag. Option D is wrong because `imageTag` is not a valid field in Kustomize's `kustomization.yaml`; the correct field is `images`, and the key for the tag is `newTag`, not `tag`.

13
Multi-Selecthard

Which TWO of the following are correct methods to implement a canary deployment using Kubernetes resources?

Select 2 answers
A.Use a Deployment with 'strategy.type: Canary' in the spec.
B.Create two Services and use a header-based routing to send specific users to canary.
C.Create two Deployments (stable and canary) with a shared Service that selects both based on a common label. Initially, canary has 1 replica while stable has many. Gradually increase canary replicas.
D.Create two separate Services, one for stable and one for canary, and use DNS to route a percentage of traffic.
E.Use an Ingress controller that supports traffic splitting (like Nginx Ingress with canary annotation) to route a percentage of requests to the canary Deployment.
AnswersC, E

This is the classic Kubernetes-native canary pattern: both Deployments' pods share a common label (e.g., app: myapp, version: stable/canary) and the same Service selects on that common label, so the Service's Endpoints automatically include pods from both versions. The proportion of requests reaching the canary is approximately the ratio of canary replicas to total replicas, so starting with 1 canary replica and many stable replicas delivers a small traffic share. Incrementally scaling up canary replicas shifts more traffic incrementally, allowing monitoring for regressions without needing any additional routing components.

Why this answer

Option C is correct because a native Kubernetes approach to canary deployment is to run two Deployments (stable and canary) that share a common label selected by a single Service; by starting the canary with 1 replica versus many stable replicas, the Service load-balances across all matching pods, so the canary receives a small fraction of traffic that grows as you scale its replicas up. Option E is correct because an Ingress controller such as NGINX Ingress supports canary traffic splitting via annotations (e.g., nginx.ingress.kubernetes.io/canary: "true" with canary-weight or canary-by-header), letting you route a defined percentage of requests to a separate canary Deployment/Service without touching the stable path. Option A is wrong because Kubernetes Deployment strategy.type only supports Recreate and RollingUpdate; there is no built-in 'Canary' strategy type.

Option B is wrong because plain Kubernetes Services do not perform header-based routing; that requires an Ingress controller or service mesh, and the option as stated misattributes the capability to Services. Option D is wrong because DNS-based percentage routing is not a Kubernetes resource mechanism and DNS cannot reliably split traffic by percentage at the request level.

Exam trap

CKAD often tests the misconception that Kubernetes has a built-in 'Canary' Deployment strategy — candidates must recognize that canary is a pattern built from primitives (Deployments, Services, Ingress), not a native strategy.type value.

14
Multi-Selecthard

Which TWO of the following conditions must be met for a RollingUpdate to proceed?

Select 2 answers
A.The new pod must pass its readiness probe
B.The number of unavailable pods must not exceed maxUnavailable
C.The new ReplicaSet must have the desired number of pods
D.The old ReplicaSet must be scaled to zero
E.The old ReplicaSet must be deleted
AnswersA, B

During a rolling update, the Deployment controller creates a new ReplicaSet and scales it up. Before it proceeds to terminate old pods and scale up further, it must confirm that newly created pods are actually Ready by passing their readiness probes. If a new pod fails its readiness probe, the rollout stalls to protect availability, preventing traffic from being routed to unhealthy pods and avoiding cascading failures.

Why this answer

A is correct because during a RollingUpdate, the new pod must pass its readiness probe before the old pod is terminated. This ensures the new pod is capable of serving traffic, preventing service disruption. The readiness probe is checked by the kubelet, and only when it succeeds does the ReplicaSet controller proceed with the update.

Exam trap

The trap here is that candidates often confuse the conditions for a RollingUpdate to proceed with the final state of the update, mistakenly thinking the old ReplicaSet must be scaled to zero or deleted, when in fact the update proceeds incrementally and the old ReplicaSet is only scaled down as new pods become ready.

15
Multi-Selectmedium

A team is deploying a multi-container pod with a main application container and a sidecar container for logging. Which THREE statements about pod design are correct?

Select 3 answers
A.Containers in a pod share the same filesystem root.
B.Containers in a pod share the same network namespace.
C.Containers in a pod can share the same volume mounts.
D.The sidecar container must use the same image as the main container.
E.The sidecar container should be designed to not block the main container from starting.
AnswersB, C, E

Containers in a pod share the same network namespace, meaning they have a single IP address, a shared port space, and a common loopback interface. This allows the main application and sidecar to communicate directly on localhost without additional service discovery. However, they do not automatically share a filesystem unless a volume is explicitly mounted into both.

Why this answer

Containers within the same Kubernetes pod share the same network namespace, including the same IP address and port space. This allows them to communicate via localhost and share network resources, which is essential for sidecar patterns like logging agents that need to intercept or monitor the main container's traffic.

Exam trap

CNCF often tests the misconception that containers in a pod share the same filesystem root, but in reality they only share volumes via explicit mounts, not the entire root filesystem.

16
MCQeasy

Which command is used to rollback a Deployment to the previous revision?

A.kubectl rollout undo deployment my-deployment
B.kubectl rollout redo deployment my-deployment
C.kubectl rollout revert deployment my-deployment
D.kubectl rollout history deployment my-deployment
AnswerA

The `kubectl rollout undo deployment my-deployment` command is the correct rollback mechanism because it reverts the Deployment to the previously active ReplicaSet, effectively restoring the last known good Pod template. You can optionally specify `--to-revision` to target a specific historical revision; otherwise, it undoes only the most recent rollout, scaling down the current ReplicaSet and scaling up the prior one.

Why this answer

'kubectl rollout undo deployment my-deployment'. Option B rolls forward? Option C is not valid. Option D is for history.

17
MCQeasy

During a rolling update, you want to ensure that at most 2 pods are unavailable at any time. Which field should you set in the Deployment spec?

A.spec.strategy.type: Recreate
B.spec.replicas: 2
C.spec.strategy.rollingUpdate.maxSurge: 2
D.spec.strategy.rollingUpdate.maxUnavailable: 2
AnswerD

spec.strategy.rollingUpdate.maxUnavailable: 2 directly caps the number of pods that may be unavailable during a rolling update, ensuring that at most 2 pods are down at any given time relative to the desired replica count. The Deployment controller uses this value to decide when it can scale down old ReplicaSets and scale up new ones, keeping the available pod count at desired minus 2. This is the exact setting needed for the stated requirement of allowing at most 2 replicas to be unavailable.

Why this answer

`spec.strategy.rollingUpdate.maxUnavailable` specifies the maximum number of Pods that can be unavailable during a rolling update. Setting `maxUnavailable: 2` ensures that at most 2 Pods are unavailable at any time, allowing the update to proceed while maintaining the desired availability.

Exam trap

The trap here is confusing `maxSurge` (which controls extra Pods created above the desired count) with `maxUnavailable` (which controls Pods that can be unavailable), leading candidates to incorrectly select `maxSurge` when the question asks about limiting unavailable Pods.

How to eliminate wrong answers

Option A is wrong because `spec.strategy.type: Recreate` terminates all existing Pods before creating new ones, which would cause all Pods to be unavailable during the update, not limiting unavailability to 2. Option B is wrong because `spec.replicas: 2` sets the desired number of Pod replicas to 2, but does not control the number of unavailable Pods during a rolling update; it defines the target count, not a constraint on unavailability. Option C is wrong because `spec.strategy.rollingUpdate.maxSurge: 2` controls the maximum number of Pods that can be created above the desired replica count during an update, not the number of unavailable Pods.

18
MCQeasy

A developer wants to deploy a stateless application as a set of identical pods. They need the pods to be distributed across nodes and have stable network identities. Which resource should they use?

A.Job
B.Deployment
C.DaemonSet
D.StatefulSet
AnswerD

A StatefulSet assigns each pod a stable, zero-based ordinal hostname (e.g., web-0, web-1) derived from the StatefulSet name and replica index. These identities persist across rescheduling because a replacement pod always inherits the same ordinal and, if configured, the same PersistentVolumeClaim. Combined with a headless service, each pod gets a unique DNS name, which perfectly fulfills the requirement for stable network identities in a stateless or stateful application.

Why this answer

StatefulSet is the correct resource because it provides each pod with a stable, unique network identity (e.g., pod-name-0, pod-name-1) that persists across rescheduling. While Deployment manages replicas for stateless applications, it does not assign per-pod stable hostnames. The question explicitly requires 'stable network identities' for identical pods, which is a defining feature of StatefulSet.

A Service combined with a Deployment gives a stable endpoint for the set, not per-pod identities.

Exam trap

Candidates may incorrectly choose Deployment, thinking that a Service provides stable network identities. However, a Service provides a stable endpoint for the entire set of pods, not individual pod identities. StatefulSet is needed for per-pod stable DNS names, which match the requirement for 'stable network identities' for each pod.

How to eliminate wrong answers

Option A is wrong because a Job is designed for batch processing or one-time tasks, not for running a continuously serving stateless application with multiple identical pods. Option C is wrong because a DaemonSet ensures exactly one pod per node, which is used for node-level services (e.g., logging, monitoring) and does not distribute pods arbitrarily across nodes for scaling. Option D is wrong because a StatefulSet is intended for stateful applications requiring stable, unique network identities and persistent storage, which is unnecessary for a stateless application.

19
Multi-Selecteasy

A developer is creating a Deployment with 4 replicas. The application requires a rolling update with zero downtime. Which TWO strategies ensure zero downtime during an update?

Select 2 answers
A.Set maxSurge=1
B.Set maxUnavailable=1
C.Use Recreate strategy
D.Set maxUnavailable=0
E.Set maxSurge=0
AnswersA, D

Setting maxSurge=1 allows the deployment controller to create one additional pod beyond the desired 4 replicas before terminating any existing pods. This temporarily raises the total pod count to 5, ensuring that the running workload always has at least 4 available replicas throughout the rolling update. This strategy results in zero downtime as new pods become ready before old ones are removed.

Why this answer

Setting maxSurge=1 allows Kubernetes to spin up one new Pod before terminating any old Pod during a rolling update. This ensures that the total number of available Pods never drops below the desired replica count, maintaining service capacity and achieving zero downtime.

Exam trap

In Kubernetes, the trap here is that candidates often confuse maxSurge and maxUnavailable, thinking that allowing one Pod to be unavailable (maxUnavailable=1) is safe, but in a strict zero-downtime requirement, even a single unavailable Pod can cause capacity loss if the application cannot tolerate reduced replicas.

20
MCQmedium

A Deployment is configured with strategy type 'Recreate'. What happens during an update to the pod template?

A.Old pods are terminated and then new pods are created
B.New pods are created before old ones are terminated
C.Pods are updated in place
D.The update is paused until manual approval
AnswerA

When a Deployment's strategy is set to Recreate, the controller first scales the current ReplicaSet to zero, ensuring every old pod has terminated gracefully, and only then creates the new ReplicaSet and starts new pods. This eliminates any overlap between old and new versions, guaranteeing that no mixed-version traffic can occur, but it also means the application experiences full downtime during the transition. The ordering is strictly linear: the old pods must be gone before the new pods appear.

Why this answer

The Recreate strategy first terminates all existing pods, then creates new pods. This ensures that only one version is running at a time, but causes downtime.

21
MCQeasy

You need to perform a rolling update of a Deployment named 'web-app' with a new image version. Which command should you use?

A.kubectl edit deployment web-app
B.kubectl replace -f web-app.yaml
C.kubectl set image deployment/web-app app=nginx:1.21
D.kubectl rollout restart deployment/web-app
AnswerC

kubectl set image deployment/web-app app=nginx:1.21 changes the container named app in the Deployment web-app to use the nginx:1.21 image, directly altering the pod template of the Deployment. This triggers a rolling update by creating a new ReplicaSet and scaling it up while scaling down the old one, honoring maxSurge and maxUnavailable. It is the concise, imperative command explicitly designed for this image-update operation.

Why this answer

The 'kubectl set image' command is used to update the container image of a Deployment, triggering a rolling update. In this case, 'kubectl set image deployment/web-app app=nginx:1.21' updates the container named 'app' to the new image version. Options A, B, and D are incorrect: A requires editing the manifest interactively, B replaces the entire resource definition, and D restarts pods without changing the image.

22
MCQmedium

You have a Helm release named 'my-app' that you want to revert to revision 3. Which command accomplishes this?

A.helm undo my-app --revision 3
B.helm rollback my-app 3
C.helm revert my-app 3
D.helm upgrade my-app --revision 3
AnswerB

The `helm rollback my-app 3` command is the valid way to revert the release to revision 3. Helm will take the chart manifest and values stored at revision 3, apply them to the cluster, and then record a new revision number (for example, revision 5 if the current is 4) to preserve the ability to later roll forward or back. This is the canonical command for undoing a bad upgrade and it works exactly as written, with the release name and target revision as positional arguments.

Why this answer

The correct command to revert a Helm release to a previous revision is `helm rollback <release-name> <revision>`. In this case, `helm rollback my-app 3` will roll back the 'my-app' release to revision 3, restoring the Kubernetes resources to the state defined in that revision's chart and values.

Exam trap

The trap here is that candidates may confuse `helm rollback` with other verbs like `undo` or `revert` that exist in other tools (e.g., Git), or assume `helm upgrade` can target a specific revision, when in fact only `helm rollback` is the correct command for this operation.

How to eliminate wrong answers

Option A is wrong because `helm undo` is not a valid Helm command; the correct verb is `rollback`. Option C is wrong because `helm revert` is not a valid Helm command; the correct verb is `rollback`. Option D is wrong because `helm upgrade --revision` is not a valid flag; `helm upgrade` is used to install a new version of a chart, not to revert to a previous revision, and the `--revision` flag is not supported for that purpose.

23
MCQmedium

You have a Deployment named 'frontend' with 4 replicas. You want to perform a rolling update with the following constraints: the number of pods above the desired count should never exceed 1, and the number of unavailable pods should never exceed 0. Which deployment strategy configuration achieves this?

A.strategy: rollingUpdate: {maxSurge: 2, maxUnavailable: 0}
B.strategy: rollingUpdate: {maxSurge: 25%, maxUnavailable: 25%}
C.strategy: rollingUpdate: {maxSurge: 1, maxUnavailable: 0}
D.strategy: type: Recreate
AnswerC

This is the correct configuration because maxSurge: 1 caps the total number of pods at one beyond the desired 4, so at most 5 pods run during the update. Meanwhile, maxUnavailable: 0 forbids terminating any old pod until a new pod has become Ready, ensuring at least 4 pods are always available to serve traffic. Together they enforce exactly the stated constraints: no more than one extra pod and zero downtime.

Why this answer

Setting `maxSurge: 1` ensures that during a rolling update, at most one additional pod is created above the desired replica count of 4, and `maxUnavailable: 0` guarantees that no pods are taken down until the new ones are ready. This satisfies the constraints of never exceeding one extra pod and never having unavailable pods.

Exam trap

The trap here is that candidates often confuse `maxSurge` and `maxUnavailable` as percentages versus absolute values, or they mistakenly think `Recreate` can achieve zero downtime, when in fact it causes complete unavailability during the update.

How to eliminate wrong answers

Option A is wrong because `maxSurge: 2` would allow up to 2 extra pods above the desired count, violating the constraint that the number of pods above the desired count should never exceed 1. Option B is wrong because `maxUnavailable: 25%` (which equals 1 pod out of 4) would allow at least one pod to be unavailable during the update, violating the constraint that unavailable pods should never exceed 0. Option D is wrong because the `Recreate` strategy terminates all existing pods before creating new ones, causing all pods to be unavailable during the update, which directly violates the constraint of zero unavailable pods.

24
MCQmedium

During a rolling update of a Deployment with 10 replicas, you set maxSurge to 3 and maxUnavailable to 2. What is the maximum number of pods that can be unavailable during the update?

A.5
B.3
C.2
D.10
AnswerC

The maxUnavailable field directly specifies the maximum number of pods that can be unavailable during a rolling update relative to the desired replica count. With maxUnavailable set to 2, the Deployment controller will ensure that at least 8 of the 10 original pods remain available at any time. Therefore, the maximum number of unavailable pods is exactly 2.

Why this answer

maxUnavailable: 2 means at most 2 pods can be unavailable. Option C is correct.

25
MCQmedium

A HorizontalPodAutoscaler (HPA) is configured to scale a Deployment based on CPU utilization. The target CPU utilization percentage is set to 80%. The current CPU utilization is 90%. What will the HPA do?

A.Delete the pod with the highest CPU usage
B.Scale up the number of replicas
C.Do nothing because 90% is within acceptable range
D.Scale down the number of replicas
AnswerB

The HPA calculates the desired replicas using the formula desiredReplicas = ceil(currentReplicas * (currentMetric / targetMetric)). With current average CPU at 90% and target at 80%, the ratio is 1.125, so the HPA will increase the replica count to spread traffic and reduce per-pod CPU utilization back toward 80%. This is the only response aligned with the HPA's design, as scaling out dilutes workload across more pods and brings the metric within the target threshold.

Why this answer

The HPA will increase the number of replicas to bring CPU utilization down towards 80%. The exact new replicas depends on the metric, but generally it scales up.

26
MCQmedium

When using 'kubectl apply' vs 'kubectl create', which statement is correct?

A.'kubectl create' will update a resource if it already exists
B.'kubectl apply' can create or update resources; 'kubectl create' only creates and fails if resource exists
C.'kubectl apply' and 'kubectl create' are interchangeable
D.'kubectl apply' can only create resources, not update them
AnswerB

kubectl apply operates declaratively: it sends the object configuration to the API server, which computes a difference between the desired state, the current live object, and the last-applied configuration, then issues a PATCH (or a POST if the resource does not exist). This allows apply to transparently create new resources and update existing ones in the same workflow. In contrast, kubectl create is imperative and always attempts to create a fresh resource per invocation; if the API server finds an existing object with the same identity, it returns an error instead of reconciling the object. Therefore, apply is suitable for both initial creation and ongoing updates, while create is intentionally limited to one-time creation where failure on duplicates is desirable.

Why this answer

'kubectl apply' uses a declarative approach that creates a resource if it does not exist and updates it if it does, while 'kubectl create' is imperative and will fail with an error if the resource already exists. This distinction is fundamental to Kubernetes resource management, where 'apply' manages the full object state via last-applied-configuration annotations, and 'create' only handles initial creation.

Exam trap

The trap here is that candidates often confuse 'kubectl apply' with 'kubectl replace' or assume 'kubectl create' can update resources, but the CKAD exam specifically tests the declarative vs imperative paradigm and the error behavior of 'create'.

How to eliminate wrong answers

Option A is wrong because 'kubectl create' does not update an existing resource; it returns an error (e.g., 'AlreadyExists') if the resource already exists. Option C is wrong because 'kubectl apply' and 'kubectl create' are not interchangeable; they have different behaviors for updates and error handling. Option D is wrong because 'kubectl apply' can both create and update resources, as it merges the provided configuration with the existing object's state.

27
MCQeasy

Which kubectl command is used to view the rollout history of a Deployment?

A.kubectl rollout history deployment my-deployment --revision=2
B.kubectl rollout list deployment my-deployment
C.kubectl rollout history deployment my-deployment
D.kubectl rollout status deployment my-deployment
AnswerC

`kubectl rollout history deployment my-deployment` is the canonical command to view a Deployment's rollout history. It lists all revisions, showing their revision numbers and change-cause annotations (if recorded), which gives you an overview of every template change. This is exactly what the question asks for, and it provides the foundation for rolling back to a specific revision.

Why this answer

`kubectl rollout history` is the dedicated command to view the revision history of a Deployment, including the list of revisions and, optionally, details of a specific revision when combined with `--revision`. This command directly queries the Deployment's rollout history stored in its annotations (e.g., `deployment.kubernetes.io/revision`).

Exam trap

A common mistake is confusing `kubectl rollout history` (viewing past revisions) with `kubectl rollout status` (viewing current rollout progress).

How to eliminate wrong answers

Option A is wrong because it includes `--revision=2`, which is a valid flag but not required to view the overall history; the question asks for the command to view the rollout history, and the base command without the revision flag is sufficient. Option B is wrong because `kubectl rollout list` is not a valid kubectl command; the correct subcommand for listing rollout history is `history`, not `list`. Option D is wrong because `kubectl rollout status` is used to check the current status of a rollout (e.g., whether it succeeded or is still progressing), not to view the historical record of revisions.

28
MCQmedium

You have a Deployment named 'web-app' with 5 replicas. You want to perform a rolling update with a maximum of 2 extra pods during the update and allow at most 1 pod to be unavailable. Which YAML snippet correctly configures the rolling update strategy?

A.strategy: type: RollingUpdate rollingUpdate: maxSurge: 3 maxUnavailable: 0
B.strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 2
C.strategy: type: RollingUpdate rollingUpdate: maxSurge: "50%" maxUnavailable: "20%"
D.strategy: type: RollingUpdate rollingUpdate: maxSurge: 2 maxUnavailable: 1
AnswerD

This is the correct configuration: maxSurge=2 allows the Deployment to temporarily run up to 7 pods (5 desired + 2 extra), while maxUnavailable=1 guarantees that no more than 1 of the 5 desired replicas is unavailable, so at least 4 are always serving traffic. The controller first creates 2 new pods, then terminates old ones in a controlled manner, maintaining both the surge cap and availability floor. These values exactly match the requirement of allowing 2 extra pods and 1 unavailable pod during the update.

Why this answer

Ly sets maxSurge to 2 and maxUnavailable to 1. maxSurge: 2 allows up to 2 extra pods above the desired 5 replicas (total 7). maxUnavailable: 1 ensures at most 1 pod is unavailable during the update, meeting the requirement of allowing at most 1 unavailable pod.

29
MCQmedium

You have a Deployment named 'web-app' with 5 replicas. You run 'kubectl set image deployment/web-app app=nginx:1.21'. What is the effect of this command?

A.It scales the Deployment to 0 replicas and then scales back up.
B.It immediately terminates all running pods and creates new ones with the new image.
C.It creates a new Deployment with the updated image.
D.It updates the image of the container named 'app' to nginx:1.21, triggering a rolling update.
AnswerD

The command kubectl set image deployment/web app=nginx:1.21 targets the existing Deployment and updates the image of the container literally named 'app' in its pod template. This change to the pod template makes the Deployment controller detect a diff and begin a rolling update: it creates a new ReplicaSet with the nginx:1.21 image and progressively replaces old pods, preserving availability according to the rollout strategy. You can watch progress with kubectl rollout status deployment/web, and if needed, the update can be rolled back with kubectl rollout undo.

Why this answer

The `kubectl set image` command updates the container image in the Deployment's pod template. This triggers a rolling update, where the Deployment's ReplicaSet creates new pods with the new image and gradually terminates old pods, ensuring zero downtime. The container name 'app' matches the container in the pod spec, so the image is updated to nginx:1.21.

Exam trap

The trap here is that candidates may confuse `kubectl set image` with `kubectl delete pod` or assume it immediately terminates all pods, but it actually triggers a controlled rolling update that replaces pods gradually.

How to eliminate wrong answers

Option A is wrong because `kubectl set image` does not scale the Deployment to 0 replicas; it only updates the container image, and the rolling update process maintains the desired replica count throughout. Option B is wrong because the command does not immediately terminate all pods; it initiates a rolling update, which replaces pods gradually, not all at once. Option C is wrong because the command does not create a new Deployment; it modifies the existing Deployment's pod template, which triggers an update to the existing ReplicaSet.

30
MCQeasy

What is the purpose of the 'kubectl rollout status' command?

A.To roll back a deployment
B.To check the current status of a rollout
C.To view the rollout history
D.To pause a rollout
AnswerB

kubectl rollout status is the correct command to monitor a live rollout's progress. It polls the Deployment's status conditions and prints whether the update is still ongoing, has succeeded, or failed during the process deadline. It's a read-only operation and returns a successful exit code once the rollout has completed.

Why this answer

The command 'kubectl rollout status' tracks the progress of a rollout until it completes or fails.

31
Multi-Selecthard

Which of the following are valid kubectl commands for managing rollouts? (Select all that apply)

Select 4 answers
A.kubectl rollout status deployment/myapp
B.kubectl rollout diff deployment/myapp
C.kubectl rollout history deployment/myapp
D.kubectl rollout restart deployment/myapp
E.kubectl rollout pause deployment/myapp
AnswersA, C, D, E

`kubectl rollout status deployment/myapp` is a valid subcommand that monitors the progress of a rollout in real time, waiting until the Deployment's pods are fully updated and available. It returns a non-zero exit code if the rollout fails, making it valuable in CI/CD to block execution until the deployment is healthy. It is one of the primary rollout inspection commands.

Why this answer

Option A, `kubectl rollout status deployment/myapp`, is correct because it is a valid subcommand that watches the progress of a Deployment rollout until it completes or fails, reporting the current status. Option C, `kubectl rollout history deployment/myapp`, is correct because it lists the revision history of the Deployment, showing each revision number and change-cause annotation. Option D, `kubectl rollout restart deployment/myapp`, is correct because it performs a rolling restart of the Deployment by adding a restartedAt annotation to the pod template, triggering a new rollout.

Option E, `kubectl rollout pause deployment/myapp`, is correct because it pauses an in-progress rollout, allowing multiple changes to be applied before resuming with `kubectl rollout resume`. Option B, `kubectl rollout diff deployment/myapp`, is not a valid kubectl subcommand; `kubectl rollout` supports status, history, undo, restart, pause, and resume, but not diff.

Exam trap

The CKAD exam often tests the distinction between valid rollout subcommands and other kubectl commands, so candidates may mistakenly think rollout diff exists because kubectl diff is a real command. Note that all four of A, C, D, and E are valid subcommands.

32
Multi-Selecthard

Which THREE statements correctly describe Kustomize? (Select THREE.)

Select 3 answers
A.Kustomize uses a kustomization.yaml file to define customization rules.
B.Kustomize can only be used with Helm charts.
C.Kustomize requires a separate server component to run.
D.Kustomize supports strategic merge patches and JSON patches.
E.kubectl apply -k <directory> is used to apply Kustomize overlays.
AnswersA, D, E

A kustomization.yaml file is Kustomize's declarative entry point, listing resources, patches, and generators that Kustomize applies to produce the final manifests. This directly satisfies the stem's requirement for a statement describing Kustomize's core mechanism, since every overlay and base depends on this file to define its customisation rules.

Why this answer

Option A is correct because Kustomize is driven by a kustomization.yaml file that declares the resources, bases, overlays, patches, and other customization rules for a given directory. Option D is correct because Kustomize natively supports both strategic merge patches (which merge by Kubernetes object schema and merge keys) and JSON patches (RFC 6902-style operations) to modify resources. Option E is correct because kubectl has built-in Kustomize support, so kubectl apply -k <directory> builds and applies the kustomization found in that directory.

Option B is incorrect because Kustomize works with plain Kubernetes YAML manifests and is not limited to Helm charts; it can even be combined with Helm output via helm template. Option C is incorrect because Kustomize is a client-side, standalone binary (and is embedded in kubectl) with no separate server component required.

Exam trap

CKAD often tests the misconception that Kustomize requires a server component (like a controller or admission webhook) to function, but in reality it is purely client-side and runs as part of `kubectl apply -k` or the standalone `kustomize build` command.

33
MCQmedium

You want to update a Deployment's image from nginx:1.20 to nginx:1.21. Which command will perform a rolling update?

A.kubectl create deployment my-deployment --image=nginx:1.21
B.kubectl apply -f deployment.yaml
C.kubectl set image deployment/my-deployment nginx=nginx:1.21
D.kubectl edit deployment my-deployment
AnswerC

kubectl set image deployment/my-deployment nginx=nginx:1.21 is the correct imperative command because it directly changes the image of the container named nginx in the existing Deployment's pod template. The Deployment controller detects the template hash change, creates a new ReplicaSet, and performs a rolling update while keeping the Deployment name and metadata intact. This is a one-line, non-interactive, auditable update that accomplishes exactly the requested change.

Why this answer

`kubectl set image` directly updates the container image of a Deployment, which triggers a rolling update by default. The Deployment controller creates a new ReplicaSet with the updated image and gradually scales it up while scaling down the old ReplicaSet, ensuring zero downtime.

Exam trap

The trap here is that candidates may think `kubectl apply` or `kubectl edit` are the standard ways to trigger a rolling update, but the CKAD exam specifically tests the `kubectl set image` command as the direct imperative method for updating a Deployment's image.

How to eliminate wrong answers

Option A is wrong because `kubectl create deployment` creates a new Deployment resource, it does not update an existing one. Option B is wrong because `kubectl apply -f deployment.yaml` only works if the YAML file contains the updated image; the command itself does not guarantee a rolling update if the file is unchanged or if the Deployment is managed declaratively. Option D is wrong because `kubectl edit deployment` opens an editor for manual changes; while it can trigger a rolling update if the image is changed, it is not a direct command for performing a rolling update and relies on user interaction, making it less reliable for automation.

34
MCQmedium

A Deployment has been updated with a new image. After running 'kubectl rollout status deployment/myapp', you see that the rollout has stalled. You want to undo the rollout to the previous revision. What command do you run?

A.kubectl rollout restart deployment/myapp
B.kubectl rollout undo deployment/myapp
C.kubectl delete deployment/myapp --cascade=orphan
D.kubectl set image deployment/myapp app=old-image
AnswerB

This is correct because kubectl rollout undo deployment/myapp inspects the Deployment's rollout history, retrieves the spec of the last completed revision, and copies that Pod template back into the Deployment. The change triggers a new ReplicaSet that runs the previously known-good image and performs a rolling update. This is the standard, trackable mechanism for recovering from a bad rollout.

Why this answer

'kubectl rollout undo deployment/myapp' reverts the Deployment to the previous revision, which is the standard Kubernetes command for rolling back a stalled or failed rollout. This command uses the Deployment's revision history stored in its annotations to restore the prior pod template specification.

Exam trap

The trap here is that candidates confuse 'rollout restart' (which re-deploys the current image) with 'rollout undo' (which reverts to a previous revision), or they mistakenly think manually setting an old image with 'set image' is equivalent to a proper rollback, ignoring Kubernetes' built-in revision management.

How to eliminate wrong answers

Option A is wrong because 'kubectl rollout restart' triggers a new rollout by restarting pods but does not revert to a previous revision; it re-deploys the current image, which would not fix a stalled rollout with a bad image. Option C is wrong because 'kubectl delete deployment/myapp --cascade=orphan' deletes the Deployment object but leaves its ReplicaSets and pods orphaned, which does not undo the rollout and instead removes the controller managing the pods. Option D is wrong because 'kubectl set image deployment/myapp app=old-image' manually sets the container image to a specific old image, but this does not leverage the rollout history and could introduce inconsistencies if the old image is not the exact previous revision; it also does not trigger a proper rollback with revision tracking.

35
MCQmedium

You are performing a blue-green deployment. You have two Deployments: 'app-blue' and 'app-green', each with 5 replicas. Both are labeled with 'app: myapp'. The Service 'myapp-svc' selects pods with 'app: myapp' and 'version: blue'. After deploying the new version to 'app-green' and verifying it, what change is required to switch traffic to the green deployment?

A.Update the label on app-green pods to 'version: blue'
B.Update the Service selector to 'version: green'
C.Scale down app-blue to 0 replicas
D.Delete app-blue deployment
AnswerB

The Service acts as the traffic switch in a blue-green deployment; updating its selector from 'blue' to 'green' atomically redirects all client traffic to the green pods. Because green pods are already deployed and ready, this change requires no downtime and no pod restarts. This is the canonical cutover step: the selector change is the single point of control that moves production traffic to the new version.

Why this answer

In a blue-green deployment, traffic is switched by updating the Service's selector to match the labels of the new version's pods. Here, the Service 'myapp-svc' selects pods with 'version: blue'. To route traffic to the green deployment, you must change the selector to 'version: green'.

This causes the Service to immediately forward traffic to the green pods without modifying the pods themselves.

Exam trap

The trap here is that candidates often think they need to modify pod labels or scale down the old deployment, but the correct approach is to update the Service selector, which is the central mechanism for traffic routing in Kubernetes.

How to eliminate wrong answers

Option A is wrong because changing the label on app-green pods to 'version: blue' would make them indistinguishable from the blue pods, defeating the purpose of a blue-green deployment and potentially causing both sets to serve traffic simultaneously. Option C is wrong because scaling down app-blue to 0 replicas does not change the Service's selector; the Service would still target pods with 'version: blue', which would then have no endpoints, resulting in no traffic being served. Option D is wrong because deleting app-blue does not update the Service selector; the Service would still look for pods with 'version: blue', and with no such pods, traffic would be dropped.

36
MCQhard

Your Deployment is stuck during rollout, and you want to investigate. Which command pauses the rollout and allows you to check the current state?

A.kubectl rollout resume deployment my-deployment
B.kubectl rollout status deployment my-deployment
C.kubectl rollout pause deployment my-deployment
D.kubectl rollout stop deployment my-deployment
AnswerC

kubectl rollout pause is the correct command because it sets the deployment's spec.paused field to true, instructing the deployment controller to stop creating or scaling new ReplicaSets. This freezes the rollout's current state and gives you a stable point to inspect logs, events, and resource metrics without the controller racing ahead. It directly addresses the need to investigate a stuck rollout.

Why this answer

The correct command to pause a deployment rollout is `kubectl rollout pause deployment my-deployment`. While paused, you can inspect the current state with `kubectl rollout status` or other diagnostic commands. Option A (`kubectl rollout resume`) resumes a paused rollout, not pauses it.

Option B (`kubectl rollout status`) shows the rollout state but does not pause it. Option D (`kubectl rollout stop`) is not a valid kubectl command; the correct command to stop a rollout is `kubectl rollout undo`. Therefore, only option C pauses the rollout as required.

37
MCQeasy

You have a YAML file 'deploy.yaml' that defines a Deployment. Which command creates the Deployment if it does not exist, or updates it if it already exists?

A.kubectl replace -f deploy.yaml
B.kubectl patch -f deploy.yaml
C.kubectl create -f deploy.yaml
D.kubectl apply -f deploy.yaml
AnswerD

kubectl apply -f deploy.yaml is the correct declarative command for this question. It sends a PATCH request using the apply semantics, which computes a three-way merge between the local YAML, the live object's current state, and the last-applied-configuration annotation (kubectl.kubernetes.io/last-applied-configuration). This creates the Deployment if it does not exist, or updates only the fields that differ from the desired state while preserving changes made by controllers or other actors. Because the question asks about a YAML deployment definition without any conditional like 'if it does not exist', apply is the idiomatic and safe way to ensure the desired state is enforced idempotently.

Why this answer

`kubectl apply -f deploy.yaml` uses declarative object configuration: it creates the Deployment if it doesn't exist, or performs a strategic merge patch to update it if it already exists. This is the standard command for managing Kubernetes resources with a desired-state file.

Exam trap

The trap here is that candidates confuse `kubectl create` (which only creates and errors on existing resources) with `kubectl apply` (which handles both create and update), or mistakenly think `kubectl replace` works like an upsert when it actually requires the resource to already exist.

How to eliminate wrong answers

Option A is wrong because `kubectl replace -f deploy.yaml` will fail if the Deployment does not already exist, as it requires an existing resource to replace. Option B is wrong because `kubectl patch -f deploy.yaml` is not a valid command; `kubectl patch` requires specifying a resource name and a patch, not a file. Option C is wrong because `kubectl create -f deploy.yaml` will fail with an error if the Deployment already exists, as it only creates new resources and does not update.

38
MCQeasy

You want to scale a Deployment named 'frontend' to 5 replicas. Which command should you use?

A.kubectl set replicas deployment frontend=5
B.kubectl update deployment frontend --replicas=5
C.kubectl scale deployment frontend --replicas=5
D.kubectl scale --replicas=5 frontend
AnswerC

'kubectl scale' is the canonical command for resizing a Deployment's replica count. The resource type 'deployment' and the resource name 'frontend' are given as positional arguments, while '--replicas=5' sets the desired number of pods. This directly updates the Deployment's spec.replicas field and triggers the ReplicaSet/Deployment controllers to converge to the new count.

Why this answer

`kubectl scale` is the dedicated Kubernetes command to adjust the number of replicas for a Deployment (or other scalable resources). The syntax `kubectl scale deployment frontend --replicas=5` directly instructs the API server to update the Deployment's `spec.replicas` field to 5, triggering the ReplicaSet controller to create or remove Pods to match the desired count.

Exam trap

The trap here is that candidates may confuse `kubectl scale` with other imperative commands like `kubectl set` or `kubectl update`, or misorder the flags, leading them to choose syntactically invalid options that mimic common but incorrect patterns.

How to eliminate wrong answers

Option A is wrong because `kubectl set replicas` is not a valid kubectl command; the correct command for modifying a resource field is `kubectl set` (e.g., `kubectl set image`), but there is no `replicas` subcommand. Option B is wrong because `kubectl update` is not a valid kubectl command; updates are performed via `kubectl apply`, `kubectl edit`, or `kubectl patch`, not `update`. Option D is wrong because the syntax is incorrect: the resource type and name must come before the `--replicas` flag (i.e., `kubectl scale deployment frontend --replicas=5`), and placing `--replicas=5` before `frontend` causes a parsing error.

39
MCQmedium

A company wants to ensure zero-downtime deployments for a stateless web application running in Kubernetes. They have a single Deployment with 3 replicas and a Service of type LoadBalancer. Which strategy should they use to achieve this?

A.Use Recreate strategy
B.Use RollingUpdate with maxSurge=100% and maxUnavailable=100%
C.Use RollingUpdate with maxSurge=25% and maxUnavailable=0
D.Use RollingUpdate with maxSurge=0 and maxUnavailable=25%
AnswerC

With maxUnavailable=0, the rolling update guarantees that no existing pods are terminated until replacement pods have been created and reached the Ready state. The default maxSurge=25% allows the deployment to temporarily provision additional pods beyond the desired replica count, ensuring a buffer of ready pods during the transition. This combination provides zero-downtime because traffic continues to be served by the old pods until new pods are fully ready and can take over seamlessly.

Why this answer

A RollingUpdate strategy with maxSurge=25% and maxUnavailable=0 ensures that during a deployment, the desired number of replicas is always available (no downtime). maxUnavailable=0 means no old Pods are terminated until new ones are ready, and maxSurge=25% allows one extra Pod (25% of 3 replicas = 0.75, rounded up to 1) to be created before terminating old ones, maintaining capacity for zero-downtime updates.

Exam trap

The trap here is that candidates often confuse maxSurge and maxUnavailable, thinking that allowing some unavailability (e.g., maxUnavailable=25%) is acceptable for zero-downtime, but in Kubernetes, zero-downtime strictly requires maxUnavailable=0 to ensure no Pods are terminated before replacements are ready.

How to eliminate wrong answers

Option A is wrong because the Recreate strategy terminates all existing Pods before creating new ones, causing downtime during the update. Option B is wrong because maxSurge=100% and maxUnavailable=100% allows all Pods to be replaced simultaneously, which can cause a temporary loss of service if readiness probes fail or new Pods take time to become ready, violating zero-downtime requirements. Option D is wrong because maxSurge=0 and maxUnavailable=25% means no new Pods are created until old ones are terminated, reducing available capacity by 25% (1 Pod) during the update, which can cause downtime if traffic exceeds remaining capacity.

40
MCQmedium

A Deployment is configured with strategy type 'Recreate'. Which statement about this strategy is true?

A.It creates a new ReplicaSet but does not scale down the old one.
B.It updates Pods by gradually terminating old Pods and creating new ones.
C.It terminates all existing Pods before creating new Pods.
D.It first creates new Pods and then terminates old Pods.
AnswerC

Under the Recreate strategy, the Deployment controller first scales the old ReplicaSet down to zero and confirms all Pods have been terminated (respecting terminationGracePeriodSeconds and preStop hooks) before it creates any new Pods from the updated ReplicaSet. This guarantees that at no point are old and new versions running concurrently, at the cost of an explicit downtime interval during the rollout.

Why this answer

The Recreate strategy in a Kubernetes Deployment terminates all existing Pods before creating new ones, resulting in a brief period of downtime. This is the defining behavior of the Recreate strategy as documented in the Kubernetes Deployment spec. It is the opposite of RollingUpdate, which maintains availability by incrementally replacing Pods.

Exam trap

CKAD often tests the distinction between Recreate and RollingUpdate strategies, and candidates confuse the order of Pod termination and creation — Recreate kills first, RollingUpdate creates first (or in parallel).

How to eliminate wrong answers

Option A is wrong because creating a new ReplicaSet without scaling down the old one describes a partial or misconfigured rollout, not Recreate — Recreate deletes the old ReplicaSet's Pods entirely. Option B is wrong because gradually terminating old Pods and creating new ones describes the RollingUpdate strategy, not Recreate. Option D is wrong because creating new Pods before terminating old ones is also characteristic of RollingUpdate (specifically the surge behavior), whereas Recreate does the reverse order.

41
MCQeasy

Which kubectl command is used to view the rollout status of a Deployment named 'web-app'?

A.kubectl rollout history deployment web-app
B.kubectl describe deployment web-app
C.kubectl status deployment web-app
D.kubectl rollout status deployment web-app
AnswerD

kubectl rollout status deployment web-app is the dedicated command for observing the progress of a Deployment rollout. It watches the Deployment's updated ReplicaSet status and returns a stream of updates, for example 'Waiting for rollout to finish: 1 out of 3 new replicas have been updated...', exiting with 0 when the rollout succeeds or non-zero if it fails. Its synchronous behavior makes it ideal for scripting CI/CD pipelines that need to wait for a deployment to settle.

Why this answer

`kubectl rollout status deployment web-app` is the dedicated command to monitor the progress of a rollout for a Deployment named 'web-app'. It blocks until the rollout completes successfully or reports a failure, providing real-time status updates such as 'Waiting for rollout to finish' or 'deployment "web-app" successfully rolled out'.

Exam trap

The trap here is that candidates confuse `rollout history` (which shows past revisions) with `rollout status` (which shows current rollout progress), or they assume a generic `status` subcommand exists when it does not.

How to eliminate wrong answers

Option A is wrong because `kubectl rollout history deployment web-app` displays the revision history of rollouts (e.g., revision numbers and change causes), not the current rollout status. Option B is wrong because `kubectl describe deployment web-app` shows the full configuration and current state of the Deployment (e.g., replicas, conditions), but it does not actively track or report the progress of an ongoing rollout. Option C is wrong because `kubectl status deployment web-app` is not a valid kubectl command; the correct subcommand for viewing rollout progress is `rollout status`.

42
Multi-Selectmedium

Which of the following are valid methods to perform a blue-green deployment? (Choose TWO)

Select 2 answers
A.Create two Deployments for blue and green, and update the Service selector to point to the new version
B.Create a single Deployment and update the pod labels to match the Service selector
C.Use a single Deployment and change the container image, then perform a rolling update
D.Use an Ingress resource to route traffic to different Services, each backing a different version
E.Delete the old Deployment and create a new one
AnswersA, D

Two parallel Deployments let you validate the green version fully before cutover, and switching the Service selector redirects all traffic atomically without recreating pods. This satisfies the requirement for an instant, reversible switch between versions.

Why this answer

Option A is correct because a classic Kubernetes blue-green deployment runs two separate Deployments (blue and green) simultaneously, each with its own pod labels, and the cutover is performed by editing the Service's spec.selector to match the new version's labels, instantly redirecting traffic without downtime. Option D is correct because an Ingress resource can define rules that route requests to different backend Services, each fronting a different version of the app; switching the Ingress rule (or using weighted/canary annotations) shifts traffic from the blue Service to the green Service, achieving the same atomic cutover at layer 7. Option B is invalid because mutating pod labels on a single Deployment to match the Service selector does not create a parallel green environment and would cause the Service to lose its endpoints during the change, not a controlled blue-green switch.

Option C describes a standard rolling update of one Deployment, which gradually replaces pods rather than maintaining two distinct environments. Option E is not blue-green because deleting the old Deployment before creating the new one causes downtime and provides no instant rollback path.

Exam trap

CKAD often tests the misconception that a rolling update or a single Deployment with label changes constitutes blue-green, when true blue-green requires two distinct environments and a traffic-switching mechanism.

43
MCQeasy

A Deployment has 3 replicas. You run 'kubectl scale deployment mydeploy --replicas=5'. What happens?

A.The command fails because you must edit the YAML directly.
B.A new Deployment is created with 5 replicas.
C.The Deployment is updated to have 5 replicas, and the ReplicaSet creates 2 additional pods.
D.The current ReplicaSet is deleted and a new one is created with 5 replicas.
AnswerC

When you run kubectl scale deployment demo --replicas=5, the Deployment's scale subresource is updated, and the Deployment controller reconciles by adjusting the desired replicas on the currently active ReplicaSet. Because the pod template is unchanged, no new ReplicaSet is created or replaced; the existing ReplicaSet's spec.replicas is set to 5, and its controller creates exactly two new pods to go from 3 to 5 running instances.

Why this answer

`kubectl scale` updates the Deployment's `spec.replicas` field to 5, which triggers the existing ReplicaSet to adjust its pod count. The ReplicaSet controller creates 2 additional pods to match the desired state, resulting in a total of 5 pods. The Deployment itself is not replaced, and no new ReplicaSet is created unless the pod template changes.

Exam trap

The trap here is that candidates often confuse scaling with rolling updates, assuming a new ReplicaSet is always created, but scaling only changes the replica count on the existing ReplicaSet unless the pod template is modified.

How to eliminate wrong answers

Option A is wrong because `kubectl scale` is a valid imperative command for changing replica counts without editing YAML directly. Option B is wrong because scaling does not create a new Deployment; it modifies the existing one. Option D is wrong because the current ReplicaSet is not deleted; it is updated to manage the new replica count, and a new ReplicaSet is only created if the pod template (e.g., container image) changes.

44
MCQhard

You have a Helm chart that deploys a web application. You want to conditionally include a ConfigMap in the release based on a value 'config.enabled'. Which template syntax correctly implements this?

A.{% if .Values.config.enabled %} (ConfigMap YAML) {% endif %}
B.{{- if .Values.config.enabled }} (ConfigMap YAML) {{- end }}
C.{{- when .Values.config.enabled }} (ConfigMap YAML) {{- end }}
D.{{#if .Values.config.enabled}} (ConfigMap YAML) {{/if}}
AnswerB

This is the correct Helm conditional: `{{- if` trims all whitespace before it so the ConfigMap YAML sits directly at the intended indentation level, and `{{- end }}` trims the trailing whitespace after the block. Helm checks whether `.Values.config.enabled` evaluates to a truthy value (true for booleans, non-empty for strings/lists/maps) and renders the enclosed YAML only in that case. The dash (`-`) is critical for producing clean YAML without stray blank lines that can break resource parsing.

Why this answer

Helm uses Go's text/template engine, where conditionals are written as {{ if ... }} ... {{ end }}. The {{- syntax trims preceding whitespace, which is idiomatic in Helm charts to avoid stray blank lines in rendered YAML. Option B correctly uses this Go template syntax with .Values.config.enabled as the condition.

Exam trap

CKAD often tests whether candidates confuse Helm's Go template syntax with Jinja2, Handlebars, or Ansible syntax — the delimiters {{ }} with 'if/end' are the giveaway for Helm.

How to eliminate wrong answers

Option A is wrong because {% if %} is Jinja2/Ansible syntax, not Go template syntax used by Helm. Option C is wrong because 'when' is not a Go template keyword — Helm uses 'if', not 'when' (that's Ansible). Option D is wrong because {{#if}}...{{/if}} is Handlebars/Mustache syntax, which Helm does not use.

45
Multi-Selectmedium

Which TWO statements about Kustomize are true?

Select 2 answers
A.Kustomize can be used to perform canary deployments.
B.Kustomize supports overlays that allow different configurations for different environments.
C.Kustomize requires Helm to manage dependencies.
D.Kustomize uses a file named kustomization.yaml to define resources and customizations.
E.Kustomize can only be used with kubectl apply -k.
AnswersB, D

Kustomize's overlay mechanism layers environment-specific patches on top of a base kustomization, allowing you to modify replicas, images, or namespaces per environment. The base directory holds common resources, and overlays reference it via a `kustomization.yaml` with fields like `resources` and `patchesStrategicMerge`. This avoids duplicating manifests and keeps a single source of truth across dev, staging, and production.

Why this answer

Kustomize supports overlays, which are layered patches applied on top of a base configuration. This allows you to define a common base set of Kubernetes resources and then use different overlay directories (e.g., dev, staging, prod) to customize settings like replicas, image tags, or namespaces for each environment without duplicating the entire manifest.

Exam trap

CNCF often tests the misconception that Kustomize is a deployment strategy tool (like for canaries) rather than a configuration customization tool, and that it is tightly coupled to kubectl or Helm, when in fact it is a standalone declarative customization engine.

46
MCQeasy

Which kubectl command can be used to see the rollout status of a Deployment named 'web-app'?

A.kubectl rollout history deployment web-app
B.kubectl describe deployment web-app
C.kubectl status deployment web-app
D.kubectl rollout status deployment web-app
AnswerD

`kubectl rollout status deployment web-app` is the correct command to monitor a Deployment's rollout progress. It blocks and repeatedly polls the Deployment's status, providing real-time updates until the rollout completes successfully, or it exits with an error if the rollout gets stuck. This command is specifically designed to report the rollout state, waiting for the new ReplicaSet to become fully available.

Why this answer

`kubectl rollout status deployment web-app` is the dedicated command to monitor the rollout progress of a Deployment, showing whether the new ReplicaSet has been fully rolled out or if the rollout is still in progress. It provides real-time updates on the status of the rollout, such as waiting for pods to become ready or successfully completing the update.

Exam trap

The trap here is that candidates may confuse `kubectl rollout status` with `kubectl rollout history` or mistakenly think `kubectl describe` provides the same real-time rollout progress, when in fact `describe` only shows a snapshot of conditions without actively waiting for completion.

How to eliminate wrong answers

Option A is wrong because `kubectl rollout history deployment web-app` displays the revision history of the Deployment (i.e., previous rollout revisions), not the current rollout status. Option B is wrong because `kubectl describe deployment web-app` shows the current configuration and state of the Deployment, including conditions like Available and Progressing, but it does not provide a live, streaming rollout status or indicate whether a rollout is still in progress. Option C is wrong because `kubectl status deployment web-app` is not a valid kubectl command; the correct verb for checking rollout status is `rollout status`, not `status`.

47
Multi-Selectmedium

Which TWO statements about kubectl apply vs kubectl create are correct? (Select two)

Select 2 answers
A.kubectl create can update existing resources if the --force flag is used
B.kubectl apply only works with Deployments
C.kubectl apply can update existing resources; kubectl create will error if resource exists
D.kubectl create can be used to update resources by providing the full YAML
E.kubectl apply maintains a last-applied-configuration annotation; kubectl create does not
AnswersC, E

kubectl apply computes a patch between the desired configuration in your file and the current live object, then merges changes into the existing resource, thus it can update resources. In contrast, kubectl create sends a POST request to the API server and expects to create a brand-new object; if the resource already exists, the API server returns a 409 Conflict error. This fundamental difference makes apply the preferred tool for declarative updates.

Why this answer

C is correct because `kubectl apply` uses a declarative approach: it creates a resource if it does not exist and updates it if it already exists, merging changes based on the last-applied-configuration annotation. In contrast, `kubectl create` is imperative and will return an error if the resource already exists, as it expects to create a new resource from scratch.

Exam trap

The trap here is that candidates often confuse the imperative `kubectl create` with the declarative `kubectl apply`, mistakenly believing `create` can update resources or that `apply` is limited to specific resource types.

48
MCQeasy

Which of the following is the correct way to scale a Deployment named 'api' to 5 replicas using kubectl?

A.kubectl scale deployment api --replicas=5
B.kubectl scale deploy api 5
C.kubectl update deployment api --replicas=5
D.kubectl set replicas deployment api 5
AnswerA

The `kubectl scale` command is the canonical Kubernetes imperative operation for altering the desired replica count of a resource. Using `deployment api --replicas=5` explicitly identifies the resource type and name while supplying the target count through the mandatory `--replicas` flag. This triggers the scale subresource of the Deployment, updating its `spec.replicas`, and the corresponding ReplicaSet controller then adjusts pods to match. This syntax is correct because every required argument is provided and no invalid flags are used.

Why this answer

`kubectl scale deployment api --replicas=5` is the standard kubectl command to change the replica count of a Deployment. The `scale` subcommand directly modifies the `.spec.replicas` field in the Deployment's manifest, instructing the ReplicaSet controller to adjust the number of Pods to match the desired count.

Exam trap

The trap here is that candidates may confuse `kubectl scale` with other imperative commands like `kubectl set` or incorrectly assume positional arguments work for the replica count, leading them to choose options that resemble valid but non-existent syntax.

How to eliminate wrong answers

Option B is wrong because `kubectl scale deploy api 5` omits the `--replicas` flag; the `scale` command requires the `--replicas` flag (or `--replicas=` syntax) to specify the target count, and positional arguments are not accepted for the replica count. Option C is wrong because `kubectl update` is not a valid kubectl subcommand; the correct command to modify a resource is `kubectl edit`, `kubectl patch`, or `kubectl apply`, not `update`. Option D is wrong because `kubectl set replicas` is not a valid command; the correct subcommand for scaling is `kubectl scale`, and `kubectl set` is used for other purposes like `kubectl set image` or `kubectl set resources`, not for setting replica counts.

49
MCQmedium

A Deployment named 'web-app' has 4 replicas. You need to perform a rolling update with a maxSurge of 50% and maxUnavailable of 25%. Which YAML snippet configures this correctly?

A.strategy: rollingUpdate: surge: 50% unavailable: 25%
B.strategy: rollingUpdate: maxSurge: 50% maxUnavailable: 25%
C.strategy: rollingUpdate: maxSurge: 2 maxUnavailable: 1
D.strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 50%
AnswerB

This correctly sets `maxSurge: 50%` and `maxUnavailable: 25%`, which are the exact fields and values requested for managing the rolling update. With four replicas, 50% surge translates to two extra pods (rounded up), allowing up to six pods, while 25% unavailable translates to one pod down (rounded down), guaranteeing at least three pods remain available during the update. This is the valid YAML representation of a rolling update with a 50% surge and 25% maximum unavailability.

Why this answer

Ly uses the fields maxSurge and maxUnavailable with the required percentages (50% and 25%). Option A uses incorrect field names (surge, unavailable). Option C uses absolute numbers instead of percentages.

Option D swaps the values (maxSurge: 25%, maxUnavailable: 50%). Therefore, option B is the correct configuration for the rolling update.

50
MCQmedium

You are implementing a blue-green deployment using Kubernetes Deployments and Services. The 'blue' Deployment runs version 1.0, and the 'green' Deployment runs version 2.0. What is the key mechanism to switch traffic from blue to green?

A.Scale down the blue Deployment to 0 replicas
B.Delete the blue Deployment
C.Change the Service type from ClusterIP to NodePort
D.Update the Service's label selector to match the green Deployment's pod labels
AnswerD

Updating the Service's label selector to match the green Deployment's pod labels is the correct control point for traffic shifting. When the selector changes, the EndpointSlice controller re-evaluates matching Pods and replaces blue pod IPs with green pod IPs, atomically switching the backend. This approach preserves the ability to instantly roll back by reverting the selector to blue labels, provided the blue Deployment remains available.

Why this answer

By updating the Service's label selector to match the green Deployment's pod labels, the Service routes traffic to the new version.

51
MCQmedium

You have a Deployment 'app' with the following strategy configuration: 'type: RollingUpdate', 'rollingUpdate: {maxSurge: 0, maxUnavailable: 1}'. You update the container image. What is the behavior during the update?

A.A new pod is created first, then the oldest pod is terminated.
B.Two old pods are terminated at a time, while new pods are created.
C.One old pod is terminated, then a new pod is created, repeating until all pods are updated.
D.All old pods are terminated simultaneously, then new pods are created.
AnswerC

With maxSurge=0, the desired replica count cannot be exceeded, and with maxUnavailable=1, at most one pod may be down during the update. This configuration forces a strictly sequential pattern: the controller first terminates an old pod, which counts as one unavailable pod, then creates a new pod to restore the replica count to the desired number. It then repeats this cycle for each remaining old replica, so one old pod is terminated, a new pod is created, and this continues until all pods are rolled over. This approach maintains availability without any temporary scaling up.

Why this answer

With `maxSurge: 0` and `maxUnavailable: 1`, the RollingUpdate strategy ensures that during the update, no extra pods beyond the desired replica count are created (surge is zero), and at most one pod can be unavailable at any time. The Deployment controller first terminates an old pod (making one unavailable), then creates a new pod to replace it, repeating this process until all pods are updated. This guarantees a controlled, sequential rollout with minimal disruption.

Exam trap

The trap is that candidates often confuse the Kubernetes rolling update parameters: `maxSurge: 0` means no extra pods can be created above the desired count, and `maxUnavailable: 1` means at most one pod can be unavailable at a time. This results in a sequential termination-then-creation process, not parallel or batch updates.

How to eliminate wrong answers

Option A is wrong because it describes a behavior where a new pod is created before terminating an old one, which would require `maxSurge: 1` or higher; with `maxSurge: 0`, no new pod can be created until an old pod is terminated. Option B is wrong because terminating two old pods at a time would violate `maxUnavailable: 1`, which limits the number of unavailable pods to one during the update. Option D is wrong because terminating all old pods simultaneously would make all pods unavailable at once, far exceeding the `maxUnavailable: 1` limit and causing a full service disruption.

52
Multi-Selecteasy

Which TWO of the following are valid uses of Kubernetes Annotations? (Select two.)

Select 2 answers
A.Defining the name of a Kubernetes resource.
B.Identifying which pods a Service should route traffic to.
C.Configuring ingress controllers with specific settings like rewrite rules.
D.Storing non-identifying metadata such as build information or release notes.
E.Enabling service discovery between microservices.
AnswersC, D

Configuring ingress controllers with specific settings like rewrite rules is a valid use of annotations because ingress controllers (e.g., NGINX, Traefik) are designed to read controller-specific annotations attached to the Ingress resource to customize routing behavior. For example, `nginx.ingress.kubernetes.io/rewrite-target` instructs the NGINX controller to rewrite request paths before proxying them to backend services. These annotations act as declarative configuration that the controller consumes, while the core Ingress spec remains portable across different controllers.

Why this answer

Kubernetes annotations are key-value pairs used to attach arbitrary non-identifying metadata to objects, and Ingress controllers commonly use specific annotations (e.g., nginx.ingress.kubernetes.io/rewrite-target) to configure behavior like URL rewriting. This allows operators to customize controller functionality without altering the core resource definition.

Exam trap

The trap here is confusing annotations with labels: candidates often think annotations can be used for selection or routing (like Services or Deployments), but labels are the only mechanism for identification and grouping in Kubernetes.

53
MCQeasy

Which command lists all Helm releases in the current namespace?

A.helm list
B.helm get all
C.helm status
D.helm show
AnswerA

helm list is the correct command because it queries the Helm storage backend in the current Kubernetes namespace and returns all installed releases with their name, status, revision, update time, and chart version. You can filter with flags like --namespace and --all-namespaces, and by default it excludes uninstalled releases.

Why this answer

The `helm list` command is the correct way to list all Helm releases in the current namespace. It queries the Helm release storage (typically Secrets in the cluster) and returns the release names, status, chart versions, and other metadata for the namespace set in the current kubeconfig context.

Exam trap

The trap here is that candidates confuse `helm list` with `helm get all` or `helm status`, mistakenly thinking those commands can list multiple releases, when in fact they operate on a single release name.

How to eliminate wrong answers

Option B is wrong because `helm get all` is not a valid Helm command; the correct command to retrieve all information about a specific release is `helm get all <release-name>`, which fetches manifests, values, and notes for a single release, not a list. Option C is wrong because `helm status <release-name>` shows the status of a single named release (e.g., deployed, failed), not a list of all releases. Option D is wrong because `helm show` is used to display information about a chart (e.g., `helm show chart`, `helm show values`) from a repository or local path, not to list releases.

54
MCQhard

You want to perform a rolling update of a Deployment. The Deployment has a maxSurge=1 and maxUnavailable=0. How many extra pods can be created above the desired count during the update?

A.Unlimited
B.0
C.1
D.Desired replicas
AnswerC

A `maxSurge` value of 1 correctly indicates that exactly one pod may be created above the desired replica count during a rolling update. This allows the Deployment controller to bring up a new pod before terminating an old one, reducing downtime while keeping the surge limited to a single extra pod. Kubernetes interprets this as an absolute number, so the controller ensures the total pod count never exceeds `replicas + 1` during the update.

Why this answer

In a rolling update with `maxSurge=1` and `maxUnavailable=0`, Kubernetes ensures that at most one extra pod can be created above the desired replica count during the update. This is controlled by the `maxSurge` field, which defines the maximum number of pods that can be created over the desired number, and here it is set to 1 (either an absolute number or a percentage, defaulting to 25%). Since `maxUnavailable=0`, no pods can be taken down before new ones are ready, so the surge allows exactly one additional pod to be created temporarily.

Exam trap

The trap here is that candidates often confuse `maxSurge` with `maxUnavailable` or assume that `maxSurge` allows unlimited pods, when in fact it is a strict integer or percentage cap that limits the number of extra pods created above the desired count.

How to eliminate wrong answers

Option A is wrong because 'Unlimited' is never allowed; Kubernetes enforces a hard limit via the `maxSurge` field, which caps the number of extra pods. Option B is wrong because 0 would mean no extra pods can be created, which would prevent any new pods from being rolled out if `maxUnavailable=0` (since you cannot delete old pods), effectively blocking the update. Option D is wrong because 'Desired replicas' would allow doubling the replica count, which is not the behavior of `maxSurge`; `maxSurge` is a separate limit (default 25% or 1) and does not equal the desired replica count.

55
MCQmedium

You want to add an annotation to a pod without modifying the pod template. Which approach should you use?

A.kubectl annotate deployment my-deployment key=value
B.kubectl label pod my-pod key=value
C.kubectl edit pod my-pod and add annotation manually
D.kubectl annotate pod my-pod key=value
AnswerD

This is the precise imperative command to add an annotation to a Pod object in the cluster. `kubectl annotate pod my-pod key=value` directly updates the `metadata.annotations` map of the specified Pod, and the change is immediately visible to the API server. This approach works for any Pod, but it is especially appropriate when the Pod is statically created or when you intentionally want to modify only the live object. For controller-managed Pods, remember that this change is ephemeral — if the Pod is recreated by its Deployment or ReplicaSet, the annotation will be lost unless the Pod template is also updated.

Why this answer

'kubectl annotate pod my-pod key=value' adds an annotation directly to the existing pod without modifying the pod template. Option A uses 'kubectl annotate deployment', which adds an annotation to the Deployment object itself, not to the pod. Option B uses 'kubectl label', which adds labels, not annotations.

Option C uses 'kubectl edit', which is not a direct annotation command and may be less efficient.

56
MCQmedium

You have deployed an application using Helm. You want to see the history of revisions for the release 'frontend' in the 'web' namespace. Which command should you use?

A.helm status frontend --namespace web
B.helm list frontend --namespace web
C.helm get manifest frontend --namespace web
D.helm history frontend --namespace web
AnswerD

helm history frontend --namespace web is the correct command to display the full revision history for the release named 'frontend' in the 'web' namespace. It outputs a table with each revision number, the chart and app version used, the status (e.g., superseded, failed, deployed), a description of the action (install, upgrade, rollback, or test), and the timestamp of the operation. This provides an audit trail that lets you verify when changes occurred, investigate unexpected behavior, and choose a revision for potential rollback, making it the appropriate command for the question.

Why this answer

The command 'helm history frontend --namespace web' lists all revisions for the release 'frontend' in the 'web' namespace.

57
MCQmedium

You are performing a blue-green deployment. You have two Deployments: 'app-blue' (current) and 'app-green' (new). Both have labels 'app: myapp' and 'version: blue' or 'version: green' respectively. The Service 'myapp-svc' selects pods with 'app: myapp, version: blue'. How do you switch traffic to the green deployment?

A.Add an additional label 'traffic: enabled' to the 'app-green' pods and update the Service to select 'traffic: enabled'
B.Update the Service selector to 'app: myapp; version: green'
C.Update the 'app-green' Deployment to have label 'version: blue'
D.Update the Service selector to 'app: myapp, version: green'
AnswerD

This is the textbook blue-green cutover. By changing the Service's selector to 'app: myapp, version: green', the Service will match only the pods belonging to the green Deployment, since those pods carry both labels. The blue pods remain running but are no longer selected, so all incoming traffic is instantly redirected to the green version. This is a declarative, reversible change that requires no pod restarts, making it the simplest and standard approach.

Why this answer

Updating the Service's selector to 'app: myapp, version: green' directs traffic to the green pods. Option B uses a semicolon instead of a comma, which is invalid syntax. Option A adds a label mismatch and does not change the Service selector.

Option C would change the green deployment's label to 'blue', causing both deployments to have the same version label, which is not a proper blue-green switch.

58
MCQeasy

In a Deployment, what is the purpose of the 'maxUnavailable' field in the rolling update strategy?

A.The maximum number of pods that can be terminated at once.
B.The maximum number of pods that can be unavailable during the update.
C.The maximum time allowed for the rollout to complete.
D.The maximum number of pods that can be created above the desired replicas.
AnswerB

This is the exact definition. During a rolling update, the Deployment controller ensures that at most maxUnavailable pods (default 25% of desired replicas, rounded to an integer) are out of service at any moment. It gives you control over the trade-off between update speed and service availability, allowing you to keep most of your workload serving traffic while the rest are replaced. This setting is evaluated continuously, so even if one pod fails to become ready, the controller pauses further changes to maintain the unavailability limit.

Why this answer

In a Deployment's rolling update strategy, the 'maxUnavailable' field specifies the maximum number of Pods that can be unavailable during the update process. This ensures that the Deployment maintains a certain level of availability by controlling how many Pods can be taken down at any given time, relative to the desired replica count. It is defined as either an absolute number or a percentage of the desired Pods, and it works alongside 'maxSurge' to manage the update's pace and safety.

Exam trap

The trap here is that candidates often confuse 'maxUnavailable' with 'maxSurge', thinking it controls the number of Pods created above the desired count, when in fact 'maxUnavailable' governs the number of Pods that can be unavailable, while 'maxSurge' controls the number of extra Pods created above the desired replicas.

How to eliminate wrong answers

Option A is wrong because 'maxUnavailable' does not limit the number of Pods that can be terminated at once; that behavior is governed by the combination of 'maxUnavailable' and 'maxSurge', but 'maxUnavailable' specifically caps the number of Pods that can be in an unavailable state, not the termination rate. Option C is wrong because there is no 'maxUnavailable' field for rollout completion time; Kubernetes uses 'progressDeadlineSeconds' to set a timeout for the rollout to complete, not 'maxUnavailable'. Option D is wrong because the maximum number of Pods that can be created above the desired replicas is controlled by the 'maxSurge' field, not 'maxUnavailable'; 'maxUnavailable' deals with unavailability, not overshooting the replica count.

59
MCQhard

You have a Deployment that uses the Recreate strategy. You update the container image. What happens to the existing pods?

A.Existing pods are not affected; you must manually delete them
B.Existing pods are terminated first, then new pods are created
C.Existing pods are gradually terminated while new pods are created
D.New pods are created alongside existing pods, then old pods are terminated
AnswerB

With the Recreate strategy, the Deployment controller first scales the old ReplicaSet to zero, ensuring all existing pods are terminated and removed. Only after all old pods have reached a terminated state does it scale up the new ReplicaSet, creating replacement pods. This guarantees that there is no overlap between old and new pod versions during the update.

Why this answer

The Recreate strategy terminates all existing pods before creating new ones, causing a brief outage. This is the defining behavior of Recreate and contrasts with RollingUpdate, which replaces pods gradually.

Exam trap

CKAD often tests the confusion between Recreate and RollingUpdate strategies, catching candidates who assume all Deployments roll out gradually by default.

How to eliminate wrong answers

Option A is wrong because the Deployment controller automatically terminates and recreates pods on image update — manual deletion is not required. Option C is wrong because gradual termination while new pods are created describes the RollingUpdate strategy, not Recreate. Option D is wrong because creating new pods alongside existing ones before terminating old ones is also RollingUpdate behavior (or blue/green), not Recreate.

60
MCQmedium

A Helm chart has the following template snippet: '{{ .Values.replicaCount }}'. You want to set replicaCount to 5 during installation. Which command should you use?

A.helm install my-release mychart --name replicaCount=5
B.helm install my-release mychart --values replicaCount=5
C.helm install my-release mychart --set replicaCount=5
D.helm install my-release mychart --set-string replicaCount=5
AnswerC

Using `--set replicaCount=5` is the correct and idiomatic way to override a single chart value from the CLI. Helm parses the value using YAML type inference, so `5` is interpreted as an integer, which aligns with the expected type for a Deployment's `replicas` field. This avoids the need to create a separate values file and gives the highest precedence among value sources, taking precedence over the chart's default `values.yaml` and any `-f` files. The `--set` flag also supports comma-separated key/value pairs and complex structures with dots.

Why this answer

The `--set` flag in Helm allows you to directly override a single value in a chart's `values.yaml` file from the command line. This is the standard way to set `replicaCount` to 5 during installation without modifying the chart or using a separate values file.

Exam trap

The trap here is that candidates confuse `--set` with `--values` or mistakenly use deprecated `--name` syntax from Helm v2, but the CKAD exam tests Helm v3 where `--set` is the correct flag for inline value overrides.

How to eliminate wrong answers

Option A is wrong because `--name` is not a valid Helm flag; Helm uses positional arguments for release name and chart, and `--name` is from older Helm v2 syntax (deprecated in Helm v3). Option B is wrong because `--values` (or `-f`) expects a file path or URL containing YAML values, not a key=value pair; it would fail to parse 'replicaCount=5' as a file. Option D is wrong because `--set-string` forces the value to be interpreted as a string, but `replicaCount` is typically an integer; using `--set-string` would pass the string '5' instead of the integer 5, which could cause type mismatch errors in templates expecting numeric operations.

61
MCQhard

You have a Deployment with the following strategy: rollingUpdate: maxSurge: 25%, maxUnavailable: 25%. The Deployment has 4 replicas. During an update, what is the minimum number of pods guaranteed to be available?

A.3
B.2
C.4
D.1
AnswerA

With a Deployment of 4 replicas and the default rolling update strategy, maxUnavailable is 25% of 4, which equals 1 (Kubernetes rounds up for maxUnavailable). This means at any point during the rollout, at most one Pod can be taken down or become unhealthy, so at least 3 replicas remain available to serve traffic. Thus the minimum guaranteed availability is 3, not 2 or 4.

Why this answer

With 4 replicas and a rolling update strategy of maxSurge: 25% and maxUnavailable: 25%, the maximum number of pods that can be unavailable during the update is 25% of 4, which is 1. Therefore, the minimum number of pods guaranteed to be available is 4 - 1 = 3. This is calculated by rounding down the maxUnavailable value (1) and ensuring the desired replica count minus unavailable pods equals the minimum available.

Exam trap

The trap here is that candidates often misinterpret the percentage calculation, incorrectly rounding up maxUnavailable (e.g., 25% of 4 = 1, but some might think it's 2 due to rounding up or misapplying the surge logic), leading them to choose 2 or 1 instead of the correct 3.

How to eliminate wrong answers

Option B (2) is wrong because it assumes maxUnavailable is 50% (2 pods), but 25% of 4 is 1, not 2. Option C (4) is wrong because it ignores the maxUnavailable setting, implying no pods can be unavailable during the update, which contradicts the rolling update strategy. Option D (1) is wrong because it assumes maxUnavailable is 75% (3 pods), which is far beyond the configured 25% limit.

62
MCQmedium

You have a Deployment with 3 replicas. You run 'kubectl rollout pause deployment/app'. Which command would you use to resume the rollout?

A.kubectl rollout resume deployment/app
B.kubectl rollout continue deployment/app
C.kubectl rollout undo deployment/app
D.kubectl rollout restart deployment/app
AnswerA

kubectl rollout resume deployment/app is the correct command because it exits the paused state created by `kubectl rollout pause`, allowing the Deployment controller to proceed with the current rollout revision. When a rollout is paused, the controller stops creating new ReplicaSets or scaling them until resumed; this command explicitly tells the controller to continue reconciling the desired state, picking up any pending changes that occurred during the pause.

Why this answer

`kubectl rollout resume deployment/app` is the specific command to resume a paused rollout, allowing the Deployment controller to continue processing updates to the Pod template. When a rollout is paused with `kubectl rollout pause`, the controller stops applying changes to the ReplicaSet; `resume` re-enables that reconciliation loop.

Exam trap

The trap here is that candidates confuse 'resume' with 'continue' or 'restart', assuming any verb that implies 'go forward' works, but Kubernetes has a precise `resume` subcommand for unpausing a rollout.

How to eliminate wrong answers

Option B is wrong because `kubectl rollout continue` is not a valid kubectl command; the correct verb for resuming a paused rollout is `resume`, not `continue`. Option C is wrong because `kubectl rollout undo` rolls back the Deployment to a previous revision, which is unrelated to pausing or resuming the current rollout process. Option D is wrong because `kubectl rollout restart` triggers a new rollout by restarting all Pods (e.g., to pick up new ConfigMaps), but it does not resume a previously paused rollout.

63
Multi-Selectmedium

Which THREE of the following are valid Kustomize features? (Select THREE)

Select 3 answers
A.serviceAccount
B.resources
C.ingress
D.patchesStrategicMerge
E.configMapGenerator
AnswersB, D, E

The 'resources' field is a foundational Kustomize feature that declares all the YAML manifests (files or directories) to be included in the final rendered output. These resources can be local files, remote URLs, or other kustomization directories, and Kustomize will merge, patch, and transform them according to the other directives in kustomization.yaml. Without 'resources', a kustomization has nothing to process, making it the core entry point for defining what your application consists of.

Why this answer

`resources` is a core Kustomize field used to list the YAML files (or directories) that form the base set of Kubernetes resources to be customized. Without `resources`, Kustomize has no manifests to process, making it essential for defining the input to the kustomization build.

Exam trap

The exam often tests the distinction between Kubernetes resource kinds (like `serviceAccount` or `ingress`) and Kustomize-specific directives (like `resources`, `patchesStrategicMerge`, or `configMapGenerator`), trapping candidates who confuse the two categories.

64
MCQmedium

You manage a Deployment named 'web' in namespace 'prod' whose pods mount a ConfigMap named 'web-config' as a volume at /etc/web. You update the ConfigMap data, but the running pods still serve the old configuration because the application only reads the mounted file at startup. You must roll out the new configuration to all pods with zero downtime and preserve the ability to roll back. What is the MOST appropriate action?

A.Edit the Deployment and change the container image tag to a new value, forcing Kubernetes to recreate all pods with the refreshed ConfigMap.
B.Use 'kubectl exec' into each pod and run a command to signal the application process to re-read /etc/web, then wait for the kubelet to sync the volume.
C.Delete the ConfigMap and recreate it with the updated data so the kubelet re-syncs the projected volume contents immediately.
D.Run 'kubectl rollout restart deployment/web -n prod', which adds a restartedAt annotation to the pod template and triggers a new revision.
AnswerD

Running kubectl rollout restart patches the Deployment's pod template with a kubectl.kubernetes.io/restartedAt annotation, creating a new ReplicaSet revision. Because volume-mounted ConfigMaps are refreshed asynchronously but the app reads only at startup, restarting pods forces them to load the new values. The old ReplicaSet is retained, so kubectl rollout undo remains available for rollback.

Why this answer

A rollout restart is the standard CKAD pattern for forcing pods to reload configuration that is consumed only at process start. It creates a new ReplicaSet revision by mutating the pod template annotation, so the rolling update proceeds with zero downtime and the previous ReplicaSet remains for rollback. Deleting the ConfigMap, changing the image, or manually signaling processes do not produce a clean, reversible rollout.

Exam trap

The trap here is assuming that because mounted ConfigMap volumes are eventually updated on disk, the application will automatically pick up new values without any pod restart.

65
Multi-Selecteasy

Which TWO of the following are valid strategies for updating a Deployment?

Select 2 answers
A.Canary
B.RollingUpdate
C.Ramped
D.Blue/Green
E.Recreate
AnswersB, E

RollingUpdate is the default Deployment strategy, which replaces old pods with new ones incrementally to maintain availability. It uses two parameters: `maxSurge` (number of extra pods allowed above desired count) and `maxUnavailable` (number of pods allowed to be down during update). This strategy is ideal for stateless applications that can tolerate multiple versions running briefly during the rollout.

Why this answer

RollingUpdate is the default update strategy in Kubernetes Deployments. It gradually replaces old Pods with new ones, ensuring zero downtime by incrementally scaling down old ReplicaSets and scaling up new ones based on configurable parameters like maxSurge and maxUnavailable.

Exam trap

CNCF often tests the distinction between built-in Kubernetes Deployment strategies (RollingUpdate, Recreate) and external deployment patterns (Canary, Blue/Green, Ramped) that require additional tooling or manual steps.

66
MCQhard

You are using a canary deployment strategy with Deployments and Services. You have a stable version (v1) and a canary version (v2). Both Deployments have the label 'app: myapp'. The Service selector is 'app: myapp'. How can you route a small percentage of traffic to the canary?

A.Set both Deployments to 10 replicas and use an Ingress with a canary weight annotation (e.g., canary-weight: '10')
B.Set the canary Deployment replicas to 1 and the stable to 9, and update the Service selector to include version: v2
C.Set the canary Deployment replicas to 10 and the stable to 1
D.Set the canary Deployment replicas to 1 and the stable to 9, and keep the Service selector as 'app: myapp'
AnswerD

Keeping the Service selector as 'app: myapp' while setting canary replicas to 1 and stable to 9 ensures that both Deployments' pods match the selector. The Service then performs round-robin or random load balancing across all matching endpoints, so traffic is distributed proportionally to pod counts—approximately 10% to canary and 90% to stable. This is the correct method because it uses the natural endpoint-count-based weighting of a Service without introducing label restrictions that would isolate one version.

Why this answer

The Service selector 'app: myapp' matches both Deployments, and by setting the canary to 1 replica and the stable to 9, the Service's round-robin load balancing (by default) distributes roughly 10% of traffic to the canary Pods and 90% to the stable Pods. This is a simple, native Kubernetes canary pattern that requires no additional components like Ingress controllers.

Exam trap

The trap is to overcomplicate the solution by introducing a specialized Ingress controller or modifying the Service selector, when the simplest approach is to adjust replica counts while keeping the selector unchanged.

How to eliminate wrong answers

Option A is wrong because it relies on an Ingress with a canary-weight annotation, which is specific to the NGINX Ingress Controller and not a core Kubernetes feature; the question does not specify that an Ingress controller is in use, and the scenario only mentions Deployments and Services. Option B is wrong because updating the Service selector to include 'version: v2' would cause the Service to only match Pods with that label, thus routing 100% of traffic to the canary and none to the stable version. Option C is wrong because setting the canary to 10 replicas and the stable to 1 would route approximately 91% of traffic to the canary, not a small percentage.

67
MCQhard

You are using a canary deployment pattern with two Deployments: 'web-stable' (version 1) and 'web-canary' (version 2). Both have the label 'app: web'. The Service 'web-svc' selects pods with 'app: web' and 'version: stable'. How do you route traffic to the canary?

A.Add the label 'version: canary' to the canary Deployment's pod template and update the Service's selector to 'app: web, version in (stable, canary)'.
B.Use kubectl rollout canary on the stable Deployment.
C.Create a new Service with selector 'app: web, version: canary' and use an ingress to split traffic.
D.Change the Service selector to 'app: web' only (remove version label).
AnswerA

Adding the 'version: canary' label to the canary pod template and updating the Service selector to a set-based requirement (version in (stable, canary)) allows the existing Service to include both stable and canary pods in its endpoints. Kubernetes Services load-balance across all ready endpoints, so traffic is distributed proportionally to the replica counts of each Deployment. You can then carefully scale the canary Deployment up to increase its traffic share, making this a native, controlled canary strategy.

Why this answer

The Service 'web-svc' currently selects pods with 'app: web' and 'version: stable'. To route traffic to the canary pods (version 2), you need to add the label 'version: canary' to the canary Deployment's pod template so that those pods are created with that label. Then, updating the Service's selector to 'app: web, version in (stable, canary)' allows the Service to match both stable and canary pods, distributing traffic between them according to the Service's default round-robin behavior.

Exam trap

The trap here is that candidates often think they need to create a separate Service or use a special command for canary deployments, when in fact Kubernetes supports canary routing simply by updating the Service's selector to include both versions' labels, leveraging the built-in load balancing.

How to eliminate wrong answers

Option B is wrong because 'kubectl rollout canary' is not a valid kubectl command; Kubernetes does not have a built-in 'rollout canary' subcommand — canary deployments are implemented manually using multiple Deployments and Service selectors. Option C is wrong because creating a separate Service for the canary and using an ingress to split traffic is an overcomplicated approach that is not required for a simple canary pattern; the question asks how to route traffic to the canary using the existing Service, and a single Service with a combined selector is the standard method. Option D is wrong because changing the Service selector to 'app: web' only (removing the version label) would cause the Service to select all pods with 'app: web', including both stable and canary, but it would also select any other pods with that label, potentially including unintended pods; more importantly, it does not provide a controlled way to gradually shift traffic — it immediately sends traffic to all matching pods without the ability to limit the canary's exposure.

68
MCQhard

You are deploying a stateful application as a StatefulSet named 'db' with three replicas and a headless Service named 'db-headless'. The application requires each pod to have a stable network identity and its own persistent storage that survives pod rescheduling. Which combination of StatefulSet fields ensures this behavior?

A.Set serviceName to 'db-headless' and define volumeClaimTemplates so each pod gets a uniquely named PVC.
B.Set podManagementPolicy to Parallel and define volumeClaimTemplates so all pods start simultaneously with their own PVCs.
C.Set serviceName to a ClusterIP Service named 'db-svc' and define volumeClaimTemplates for per-pod storage.
D.Set serviceName to 'db-headless' and use a single shared PersistentVolumeClaim mounted by all three pods.
AnswerA

The serviceName field binds the StatefulSet to a headless Service, giving each pod a stable DNS name like db-0.db-headless. volumeClaimTemplates creates a PersistentVolumeClaim per replica, named by combining the template name with the pod name, so storage is dedicated and persists across rescheduling. Together these provide the stable identity and per-pod storage the application needs.

Why this answer

Stable identity and per-pod storage in a StatefulSet come from two fields working together. serviceName must point to a headless Service so each pod gets a predictable DNS name, and volumeClaimTemplates generates a distinct PVC per replica that is retained across rescheduling. Parallel pod management or a shared PVC do not satisfy both requirements simultaneously.

Exam trap

The trap here is assuming any Service reference works for serviceName, when StatefulSet specifically requires a headless Service to produce per-pod DNS records.

69
MCQeasy

Which kubectl command is used to view the rollout status of a Deployment?

A.kubectl status deployment mydeployment
B.kubectl get rollout deployment mydeployment
C.kubectl describe rollout mydeployment
D.kubectl rollout status deployment mydeployment
AnswerD

This is the correct command. 'kubectl rollout status' tracks the lifecycle of a Deployment's rollout (or DaemonSet/StatefulSet) in real time, blocking until the desired number of pods are available. It prints progress messages such as 'Waiting for deployment spec update to be observed' and 'deployment "mydeployment" successfully rolled out', and its exit code indicates success or failure, making it ideal for scripted CI/CD pipelines.

Why this answer

The 'kubectl rollout status' command is specifically designed to show the status of a rollout for a Deployment, DaemonSet, or StatefulSet.

70
MCQmedium

You want to undo a rollout to the previous revision. Which command should you use?

A.kubectl delete deployment/myapp --cascade=orphan
B.kubectl rollout undo deployment/myapp
C.kubectl set image deployment/myapp app=myapp:previous
D.kubectl rollout history deployment/myapp --revision=2
AnswerB

`kubectl rollout undo deployment/myapp` is the correct way to revert a Deployment to its previous revision. It inspects the Deployment's rollout history (stored in the ReplicaSets it manages), identifies the most recent revision's pod template, and creates a new ReplicaSet with that template while scaling down the current one—effectively undoing the last change. This is a standard, safe operation that preserves rollout history and can be repeated to continue stepping backward.

Why this answer

`kubectl rollout undo deployment/myapp` reverts the deployment to the previous revision by default, using the rollout history stored in the deployment's ReplicaSet annotations. This command directly triggers a new rollout that matches the pod template of the prior revision, effectively undoing the last change.

Exam trap

The trap here is that candidates may confuse `rollout undo` with `set image` or `rollout history`, thinking they can manually revert by specifying a tag like 'previous' or by viewing history, but only `rollout undo` performs the actual rollback to a prior revision.

How to eliminate wrong answers

Option A is wrong because `kubectl delete deployment/myapp --cascade=orphan` deletes the deployment but leaves its ReplicaSets and pods orphaned, which does not undo a rollout but rather removes the deployment controller. Option C is wrong because `kubectl set image deployment/myapp app=myapp:previous` is not a valid command; the `set image` command requires an explicit image tag or digest, and `previous` is not a recognized reference—rollback is handled by `rollout undo`, not by image manipulation. Option D is wrong because `kubectl rollout history deployment/myapp --revision=2` only displays the details of revision 2 without performing any rollback action; it is a read-only command for inspection.

71
MCQeasy

A developer needs to run a one-time batch job to process data. After completion, the pod should be retained for logs inspection. Which Job configuration parameter should be set?

A.backoffLimit: 0
B.Leave ttlSecondsAfterFinished unset
C.ttlSecondsAfterFinished: -1
D.activeDeadlineSeconds: 3600
AnswerB

Leaving ttlSecondsAfterFinished unset is the correct way to ensure the Job and its Pods remain after completion. By default, the Kubernetes Job controller does not automatically delete finished Pods or the Job object; they stay in the cluster indefinitely until a human or an automated process removes them. This gives the developer time to inspect the Pod's logs, output files, or status, which is exactly what is needed for a one-time batch job.

Why this answer

To retain a Job's Pod after completion for log inspection, the `ttlSecondsAfterFinished` field must be left unset (or set to nil). When this field is unset, the Job controller does not automatically delete the Pod, allowing logs to be inspected. Setting it to any non-negative integer would schedule automatic deletion after that many seconds, which contradicts the requirement.

Exam trap

CNCF often tests the misconception that `ttlSecondsAfterFinished` must be set to a positive value to retain Pods, when in fact leaving it unset (nil) achieves indefinite retention, while setting it to any non-negative integer triggers automatic deletion.

How to eliminate wrong answers

Option A is wrong because `backoffLimit: 0` prevents the Job from retrying on failure, but does not affect Pod retention after completion; the Pod would still be deleted if `ttlSecondsAfterFinished` is set. Option C is wrong because `ttlSecondsAfterFinished: -1` is an invalid value; the field expects a non-negative integer or nil, and setting it to -1 would cause the Job to be rejected or ignored. Option D is wrong because `activeDeadlineSeconds: 3600` sets a maximum duration for the Job to run, after which it is terminated, but does not control Pod retention after completion; the Pod would still be deleted according to `ttlSecondsAfterFinished`.

72
MCQhard

You have a Deployment that is failing after a rollout. You want to revert to the previous revision. Which command accomplishes this?

A.kubectl rollout history deployment/myapp --revision=previous
B.kubectl rollout resume deployment/myapp
C.kubectl delete deployment/myapp --cascade=orphan && kubectl apply -f old-deployment.yaml
D.kubectl rollout undo deployment/myapp
AnswerD

`kubectl rollout undo` is the proper remediation for a failing rollout because it instructs the Deployment controller to revert to the previous revision's pod template, creating a new ReplicaSet and scaling down the bad one. This is a mutating command that performs a rolling update, so it preserves the Deployment's UID, labels, and entire revision history, letting you redo the change later. Running undo directly is far safer than deleting and recreating with an old manifest, as it uses Kubernetes' built-in revision tracking rather than a manual, history-destroying replacement.

Why this answer

The command 'kubectl rollout undo deployment/myapp' reverts a Deployment to its previous revision by rolling back to the last revision in the rollout history. This is the standard and simplest way to undo a failed rollout in Kubernetes.

Exam trap

CKAD often tests the confusion between 'rollout undo' and 'rollout history' or 'rollout resume', and candidates might mistakenly think they need to manually delete and recreate the deployment.

How to eliminate wrong answers

Option A is wrong because 'kubectl rollout history deployment/myapp --revision=previous' is not a valid command; the '--revision' flag expects a numeric revision number, not the word 'previous'. Option B is wrong because 'kubectl rollout resume' resumes a paused rollout, not reverts to a previous revision. Option C is wrong because deleting the deployment with '--cascade=orphan' and reapplying an old YAML is a manual, error-prone process that does not leverage Kubernetes' built-in rollout history and can leave orphaned resources.

73
MCQmedium

What is the effect of running 'kubectl rollout pause deployment web'?

A.It marks the deployment as paused, and no changes are applied until 'kubectl rollout resume' is run.
B.It stops all Pods in the deployment.
C.It deletes the deployment and recreates it.
D.It prevents new Pods from being created.
AnswerA

Executing 'kubectl rollout pause deployment' sets the deployment's .spec.paused field to true. This causes the deployment controller to stop reconciling the desired state from the deployment specification, meaning any template, image, or label changes are not propagated to the existing ReplicaSet. The current ReplicaSet and its Pods remain untouched, and the rollout is effectively frozen until 'kubectl rollout resume deployment' sets paused back to false, at which point the controller resumes applying changes.

Why this answer

Running 'kubectl rollout pause deployment web' marks the deployment as paused, which means that any subsequent changes to the deployment's spec (e.g., updating the container image) will not trigger a rollout or create new ReplicaSets. The current state of the Pods remains unchanged until 'kubectl rollout resume' is executed, which resumes the rollout and applies any pending changes. This is a Kubernetes-native mechanism to control the timing of rollouts, often used for canary deployments or manual verification.

Exam trap

The trap here is that candidates often confuse 'pausing a rollout' with 'stopping Pods' or 'preventing scaling', but the command only suspends the deployment controller's automatic rollout logic, not the Pod lifecycle or manual scaling operations.

How to eliminate wrong answers

Option B is wrong because 'kubectl rollout pause' does not stop any Pods; it only pauses the deployment controller's reconciliation loop, leaving existing Pods running. Option C is wrong because the command does not delete or recreate the deployment; it simply suspends the rollout process, preserving the current ReplicaSet and Pods. Option D is wrong because it does not prevent new Pods from being created in general; it only prevents the deployment controller from creating new Pods as part of a rollout, but existing ReplicaSets can still scale up or down if triggered by other means (e.g., manual 'kubectl scale').

74
Multi-Selectmedium

Which TWO of the following are correct ways to pause a rollout of a Deployment named 'myapp'? (Select TWO)

Select 2 answers
A.kubectl rollout pause deployment/myapp
B.kubectl rollout undo deployment/myapp
C.kubectl edit deployment myapp and set spec.paused: true
D.kubectl rollout resume deployment/myapp
E.kubectl set image deployment/myapp app=nginx && kubectl rollout pause deployment/myapp
AnswersA, C

kubectl rollout pause deployment/myapp is the dedicated imperative command for pausing a rollout. It immediately sets the deployment's spec.paused field to true, which halts any ongoing rollout and prevents any new rollout from being triggered until the rollout is resumed. This is the standard, direct method because it requires no manual manifest edits and is explicitly designed for this purpose.

Why this answer

`kubectl rollout pause deployment/myapp` is the dedicated command to pause a rollout. Option C is also correct because the Deployment spec includes a `paused` field; setting `spec.paused: true` via `kubectl edit` or `kubectl patch` achieves the same effect. Option B (`kubectl rollout undo`) rolls back a rollout, not pauses it.

Option D (`kubectl rollout resume`) resumes a paused rollout. Option E triggers a new rollout with `set image` before pausing, which does not simply pause the current rollout.

Exam trap

A common trap is assuming that only the dedicated `kubectl rollout pause` command can pause a rollout. In fact, setting `spec.paused: true` via `kubectl edit` (or `patch`) is also a valid method, as the `paused` field exists in the Deployment spec. Candidates may overlook this alternative.

75
MCQhard

You want to perform a canary deployment where 10% of traffic goes to the new version. You have a Deployment 'app-v1' with 10 replicas. You create a second Deployment 'app-v2' with 1 replica and a new Service. What Kubernetes resource is typically used to split traffic between the two Services?

A.A single Service with multiple selectors
B.NetworkPolicy
C.Ingress resource with a canary annotation
D.HorizontalPodAutoscaler
AnswerC

Ingress controllers such as NGINX, Traefik, and HAProxy implement canary annotations (for example, nginx.ingress.kubernetes.io/canary-weight) that instruct the controller to send a specified percentage, e.g. 10%, of requests to a secondary canary Service while the rest go to the stable Service. The annotation can also be based on headers or cookies for test-specific routing. This gives a control plane at the edge to adjust weight dynamically without redeploying Services.

Why this answer

An Ingress resource with a canary annotation (e.g., `nginx.ingress.kubernetes.io/canary-weight: "10"`) allows you to split traffic between two Services by weight. This is the standard Kubernetes approach for canary deployments, where the Ingress controller (like NGINX) routes a specified percentage of traffic to the canary Service (app-v2) and the rest to the primary Service (app-v1).

Exam trap

The trap here is that candidates confuse Ingress with Service-level traffic splitting, forgetting that a standard Kubernetes Service does not support weighted routing between multiple Deployments, while an Ingress with a canary annotation does.

How to eliminate wrong answers

Option A is wrong because a single Service cannot have multiple selectors; a Service's selector is a single label query, and traffic is load-balanced across all pods matching that selector, not split between two distinct Deployments. Option B is wrong because NetworkPolicy controls pod-to-pod traffic and does not provide traffic splitting or routing capabilities between Services. Option D is wrong because HorizontalPodAutoscaler scales replicas based on metrics like CPU/memory, not traffic splitting between versions.

Page 1 of 3 · 163 questions totalNext →

Ready to test yourself?

Try a timed practice session using only Ckad Deployment questions.