Courseiva

CCNA Ckad Deployment Questions

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

76
Multi-Selecthard

Which FOUR of the following are valid fields in a HorizontalPodAutoscaler (HPA) v2 specification?

Select 4 answers
A.spec.targetCPUUtilizationPercentage
B.spec.metrics
C.spec.minReplicas
D.spec.behavior
E.spec.maxReplicas
AnswersB, C, D, E

spec.metrics is a list of metric specifications in the autoscaling/v2 HPA API. It defines one or more metrics (resource, container resource, external, or object/pods) that the controller evaluates when computing the desired replica count. Each entry includes a type and target, such as AverageUtilization for CPU. This field replaces v1's single CPU metric, enabling multi-metric scaling where the largest resulting replica count wins.

Why this answer

In HPA v2 (autoscaling/v2), the spec includes 'metrics', 'behavior', 'minReplicas', and 'maxReplicas'. All four of these fields are valid in the v2 specification. 'targetCPUUtilizationPercentage' is a deprecated field from v1 and is not part of the v2 spec. Therefore, options B, C, D, and E are correct.

Exam trap

Candidates might overlook one of the valid fields, but all four spec fields (B, C, D, E) are valid in v2. Ensure you know the correct fields for v2.

77
MCQmedium

You want to perform a canary deployment. You have a Deployment 'app-v1' with 10 replicas. You create a new Deployment 'app-v2' with 1 replica. Both have the label 'app: myapp'. The Service 'myapp-svc' uses selector 'app: myapp'. How do you gradually increase traffic to v2?

A.Create a second Service for v2 and use DNS weighting.
B.Gradually increase the replicas of app-v2 and decrease those of app-v1.
C.Update the Service selector to include version labels.
D.Use 'kubectl set image' on the existing Deployment.
AnswerB

Since both Deployments carry the same labels expected by the Service, their Pods are all included in the Service's endpoints. By gradually increasing the replicas of app-v2 while decreasing app-v1, you change the ratio of v2 Pod IPs to v1 Pod IPs in that endpoint list, and kube-proxy's round-robin load balancing naturally sends a corresponding proportion of traffic to each version. This gives you a gradual, reversible canary progression that you can manually control or script based on metrics.

Why this answer

By increasing the number of replicas in the v2 Deployment, more pods will be available to receive traffic from the Service, as both versions share the same label.

78
MCQmedium

A team is deploying a microservice that must be reachable within the cluster via a stable DNS name. They also need to distribute traffic among pods. Which Kubernetes resource provides both service discovery and load balancing?

A.Service
B.ConfigMap
C.Secret
D.Ingress
AnswerA

A Service provides a stable virtual IP (ClusterIP) and a DNS record via the cluster's internal DNS (e.g., <service>.<namespace>.svc.cluster.local), so clients can resolve the backend without knowing individual Pod IPs. It uses label selectors to identify target Pods and load-balances traffic across them, which is precisely what this microservice needs for reliable internal reachability. This is the standard Kubernetes abstraction for service discovery within a cluster.

Why this answer

A Service in Kubernetes provides a stable DNS name (via cluster DNS, e.g., CoreDNS) that resolves to the Service's ClusterIP, and it load-balances traffic across the pods selected by its label selector using iptables or IPVS rules. This directly fulfills the requirement for both service discovery and load balancing within the cluster.

Exam trap

The trap here is that candidates often confuse Ingress with internal service discovery, but Ingress is designed for external traffic routing and does not provide a stable DNS name for pod-to-pod communication within the cluster.

How to eliminate wrong answers

Option B (ConfigMap) is wrong because it is used to store configuration data as key-value pairs and does not provide any network endpoint or load-balancing functionality. Option C (Secret) is wrong because it stores sensitive data like passwords or tokens and has no role in service discovery or traffic distribution. Option D (Ingress) is wrong because it operates at the HTTP/HTTPS layer to expose services externally (outside the cluster) and does not provide internal DNS-based service discovery or Layer 4 load balancing within the cluster.

79
MCQeasy

Which Helm command is used to install a chart from a repository?

A.helm repo add stable https://charts.helm.sh/stable
B.helm create mychart
C.helm install myrelease stable/nginx
D.helm upgrade myrelease stable/nginx
AnswerC

helm install myrelease stable/nginx creates a new release named 'myrelease' by resolving the chart reference 'stable/nginx' from your configured repositories, rendering its templates, and applying the resulting Kubernetes manifests to the cluster. This command performs the actual first-time deployment, which is exactly what the question asks for. Without a prior release, this is the only valid way to install a chart from a repo.

Why this answer

`helm install myrelease stable/nginx` installs a chart named 'nginx' from the 'stable' repository, creating a release named 'myrelease'. This command requires the chart reference to include the repository alias (e.g., 'stable/nginx') after the repository has been added with `helm repo add`.

Exam trap

The trap here is confusing repository management commands (`helm repo add`) with chart installation commands (`helm install`), leading candidates to select the command that adds a repository instead of the one that actually deploys the chart.

How to eliminate wrong answers

Option A is wrong because `helm repo add` only adds a repository to the local Helm configuration; it does not install any chart. Option B is wrong because `helm create mychart` scaffolds a new chart directory structure locally, not installing anything from a repository. Option D is wrong because `helm upgrade` is used to upgrade an existing release, not to perform an initial installation; it would fail if the release does not already exist.

80
MCQmedium

You need to perform a blue-green deployment using Deployments and Services. What is the most common approach to switch traffic from the old version (blue) to the new version (green)?

A.Update the Deployment's image field in the blue Deployment to the new version
B.Change the Service's label selector to point to the green Deployment's pod labels
C.Delete the blue Deployment and create the green Deployment
D.Scale the blue Deployment to 0 and the green Deployment to desired replicas
AnswerB

Altering the Service's label selector to match the green Deployment's pod labels is the canonical blue-green traffic switch. Because the Deployment labels are immutable to the selector only after the fact, you simply retarget the Service to the already-running and ready green pods, instantly moving all traffic without redeploying anything. This provides zero-downtime shifting and makes rollback trivial by reverting the selector to blue.

Why this answer

In a blue-green deployment, the Service acts as the traffic router by using a label selector to match pods. By updating the Service's selector to match the green Deployment's pod labels (e.g., `version: green`), traffic is instantly switched from blue pods to green pods without any downtime, as Kubernetes Services use label selectors to dynamically route traffic to matching pods.

Exam trap

The trap here is that candidates often confuse a blue-green deployment with a rolling update or scaling strategy, and mistakenly think that updating the image (Option A) or scaling (Option D) is sufficient to switch traffic, ignoring the critical role of the Service's label selector in directing traffic to the correct set of pods.

How to eliminate wrong answers

Option A is wrong because updating the image field in the blue Deployment triggers a rolling update, not a blue-green switch; this mixes old and new pods during the transition and defeats the purpose of having two separate environments. Option C is wrong because deleting the blue Deployment before creating the green one causes downtime, as there is no overlap period to validate the green deployment before cutting over. Option D is wrong because scaling blue to 0 and green to desired replicas does not automatically redirect traffic; the Service's label selector must still be updated to point to green pods, otherwise traffic continues to blue pods even if they are scaled down (and will fail if blue has 0 replicas).

81
MCQmedium

What is the purpose of the 'values.yaml' file in a Helm chart?

A.It stores the release history.
B.It defines the Kubernetes resources to be created.
C.It lists dependencies of the chart.
D.It contains default configuration values for the chart.
AnswerD

values.yaml is the central place where chart authors define default configuration values in key-value form, such as replica counts, image tags, or service ports. When a user installs the chart without specifying overrides, Helm uses these defaults to render the templates, but the defaults can be overridden at install or upgrade time using --values or --set flags. This design keeps templates reusable and lets users customize a chart without editing its source.

Why this answer

The `values.yaml` file in a Helm chart provides default configuration values that can be overridden at install or upgrade time using the `--values` or `--set` flags. These values are injected into the chart's templates via Go template syntax, enabling parameterized deployments without modifying the chart itself.

Exam trap

The trap here is confusing the role of `values.yaml` with that of template files or `Chart.yaml`, as candidates often assume `values.yaml` defines resources or dependencies rather than providing configurable parameters.

How to eliminate wrong answers

Option A is wrong because release history is stored in Helm's release storage (typically Secrets or ConfigMaps in the cluster), not in a chart file. Option B is wrong because Kubernetes resources are defined in template files (e.g., `deployment.yaml`, `service.yaml`) under the `templates/` directory, not in `values.yaml`. Option C is wrong because chart dependencies are listed in the `Chart.yaml` file under the `dependencies` field, not in `values.yaml`.

82
Multi-Selecthard

Which THREE of the following are valid ways to update a Deployment's container image in Kubernetes?

Select 3 answers
A.kubectl apply -f updated-deployment.yaml with the new image.
B.kubectl set image deployment/myapp myapp=nginx:1.20
C.kubectl update deployment myapp --image=nginx:1.20
D.kubectl rollout image deployment myapp nginx:1.20
E.kubectl edit deployment myapp and change the image in the editor.
AnswersA, B, E

kubectl apply is a declarative command that merges the changes from the provided updated-deployment.yaml into the live Deployment object. It calculates a patch based on the difference between the new file and the existing object, then updates only the modified fields, such as the container image. This is a valid, recommended approach because the file represents the complete desired state, and apply also records the applied configuration for future three-way merges.

Why this answer

`kubectl apply -f updated-deployment.yaml` applies a declarative configuration that includes the new container image. When the Deployment manifest is updated with the new image and reapplied, Kubernetes performs a rolling update to gradually replace pods with the new image, ensuring zero downtime if configured correctly.

Exam trap

The trap here is that candidates may confuse `kubectl rollout` with `kubectl set image` or invent commands like `kubectl update` or `kubectl rollout image`, which do not exist in kubectl's command set.

83
MCQmedium

A company wants to deploy a stateless web application on Kubernetes. The application needs to be accessible externally via a stable IP address and should support SSL termination at the ingress level. Which resource should be used to route external traffic to the application?

A.ClusterIP
B.NodePort
C.Ingress
D.LoadBalancer
AnswerC

Ingress is the correct choice because it acts as a cluster-level HTTP(S) reverse proxy that exposes the web application to the internet while providing SSL/TLS termination, name-based virtual hosting, and path-based routing rules. An Ingress controller (such as NGINX or Traefik) reads Ingress resources and configures the proxy accordingly, allowing the web app to use a single external endpoint with a secure HTTPS listener. This matches the requirements precisely: external access, SSL termination, and routing are all natively supported by the Ingress API.

Why this answer

Ingress is the correct resource because it provides external HTTP/HTTPS access to services within a cluster, supports SSL/TLS termination at the ingress controller level, and can expose multiple services under a single stable IP address or hostname. Unlike other service types, Ingress is specifically designed for layer 7 routing and SSL termination, making it ideal for stateless web applications that require a stable external endpoint.

Exam trap

The trap here is that candidates often confuse LoadBalancer with Ingress, thinking LoadBalancer can handle SSL termination natively, but in Kubernetes, LoadBalancer only provides a stable external IP at layer 4 (TCP/UDP) and does not terminate SSL; SSL termination is a layer 7 feature that requires an Ingress controller or a separate reverse proxy.

How to eliminate wrong answers

Option A is wrong because ClusterIP exposes the service only on a cluster-internal IP, making it unreachable from outside the cluster without additional components like a proxy or port-forward. Option B is wrong because NodePort exposes the service on a static port on each node's IP, but it does not support SSL termination natively, requires managing non-standard ports, and does not provide a stable external IP. Option D is wrong because LoadBalancer provisions an external load balancer with a stable IP, but it does not handle SSL termination at the ingress level; SSL termination would need to be configured separately on the load balancer or within the application, and it typically creates one load balancer per service, which is less efficient for multiple services.

84
MCQeasy

A developer needs to run a one-off batch job that processes a queue and must complete exactly once before the pod is terminated. The container image is 'registry.example.com/worker:1.4'. Which resource should be created to meet this requirement?

A.A CronJob with a schedule of '* * * * *' so the worker runs every minute and eventually processes the queue.
B.A Deployment with replicas set to 1 and a restartPolicy of Always so the worker restarts if it exits.
C.A bare Pod manifest with no controller, relying on the kubelet to restart the container if it fails.
D.A Job with a pod template that sets restartPolicy to Never or OnFailure and a backoffLimit controlling retries.
AnswerD

A Job is the Kubernetes workload designed for run-to-completion tasks. Its pod template must specify restartPolicy Never or OnFailure, and backoffLimit governs retry attempts on failure. Once the container exits successfully, the Job marks completion and does not restart the pod, which matches the requirement that the batch process complete exactly once.

Why this answer

A Job is purpose-built for run-to-completion workloads. Setting restartPolicy to Never or OnFailure and configuring backoffLimit gives controlled retries on failure, while a successful exit marks the Job complete without restarting the pod. Deployments restart containers indefinitely, CronJobs repeat on a schedule, and bare Pods lack controller-managed completion and rescheduling.

Exam trap

The trap here is treating a one-off batch task like a long-running service and choosing a Deployment, which would restart the container after it exits successfully.

85
Multi-Selecteasy

Which TWO are valid fields in a Deployment's rollingUpdate configuration? (Select 2)

Select 2 answers
A.minReadySeconds
B.maxSurge
C.maxUnavailable
D.progressDeadlineSeconds
E.revisionHistoryLimit
AnswersB, C

maxSurge is a valid field within the `rollingUpdate` configuration. It specifies the maximum number of pods (or a percentage of desired pods) that can be created above the desired replica count during an update. This controls how quickly the Deployment can add new pods while maintaining available capacity, and it works together with maxUnavailable to define the update's pace.

Why this answer

In a Deployment's rolling update configuration, the `maxSurge` field defines the maximum number of Pods that can be created above the desired replica count during the update, while `maxUnavailable` defines the maximum number of Pods that can be unavailable during the update. Both are valid fields within the `spec.strategy.rollingUpdate` object in a Kubernetes Deployment.

Exam trap

Kubernetes often tests the distinction between fields that belong to the Deployment's spec versus those that belong specifically to the rollingUpdate subfield, causing candidates to confuse minReadySeconds, progressDeadlineSeconds, or revisionHistoryLimit as part of the rolling update configuration.

86
Multi-Selectmedium

Which THREE of the following are correct statements about Helm?

Select 3 answers
A.Values defined in a 'values.yaml' file can be referenced in templates using '{{ .Values.key }}'.
B.The command 'helm rollback RELEASE REVISION' can undo a release to a previous revision.
C.Helm can be used to manage the lifecycle of a Kubernetes cluster itself.
D.Helm uses a two-way strategic merge patch during upgrades.
E.Helm charts can be stored in a Helm repository and shared.
AnswersA, B, E

values.yaml is the default source of user-supplied configuration for a Helm chart. During chart rendering, the template engine merges values.yaml with any --set or -f overrides, and the resulting object is exposed as .Values in Go templates.

Why this answer

Option A is correct because Helm's templating engine exposes the merged values from values.yaml (and overrides) under the .Values object, so a key defined there is referenced in a template as {{ .Values.key }}. Option B is correct because 'helm rollback RELEASE REVISION' reverts a named release to the specified revision number, restoring the Kubernetes resources to that prior state. Option E is correct because charts are packaged artifacts that can be pushed to and pulled from a Helm repository (an HTTP server hosting an index.yaml plus .tgz chart files), enabling sharing and versioned distribution.

Option C is not correct because Helm manages applications deployed into a Kubernetes cluster, not the cluster's own lifecycle (that is the role of tools like kubeadm, kops, or Cluster API). Option D is not correct because Helm 3 uses a three-way strategic merge patch during upgrades (comparing the old manifest, the new manifest, and the live state), not a two-way merge.

Exam trap

CKAD often tests Helm version differences — candidates incorrectly assume Helm 2's two-way patch or Tiller-based architecture still applies in Helm 3.

87
Multi-Selecteasy

Which TWO of the following are correct about the difference between 'kubectl apply' and 'kubectl create'?

Select 2 answers
A.'kubectl apply' can be used to update existing resources, whereas 'kubectl create' will fail if the resource already exists.
B.'kubectl apply' is declarative, while 'kubectl create' is imperative.
C.'kubectl apply' can only be used to create resources, not update them.
D.'kubectl apply' will delete resources if they are removed from the file.
E.'kubectl create' can only create resources from YAML files, not from stdin.
AnswersA, B

kubectl apply performs a merge-patch on an existing object's desired state, so it can seamlessly update a resource that already exists in the cluster, whereas kubectl create sends POST requests to the API server and receives an AlreadyExists error if the resource is present. This distinction is fundamental: create is for initial provisioning only, while apply is idempotent and safe to run multiple times, making it ideal for declarative configuration management in CI/CD pipelines.

Why this answer

'kubectl apply' can update existing resources, while 'kubectl create' will fail if the resource already exists. Option B is correct: 'kubectl apply' is declarative (manages desired state), whereas 'kubectl create' is imperative (directly creates). Option C is false: 'kubectl apply' can both create and update resources.

Option D is false: 'kubectl apply' does not delete resources removed from the file; it only manages the resources in the file. Option E is false: 'kubectl create' can create resources from stdin, not just YAML files.

88
MCQeasy

Which command shows the rollout history of a Deployment named 'web'?

A.kubectl rollout status deployment web
B.kubectl get deployment web -o yaml
C.kubectl describe deployment web
D.kubectl rollout history deployment web
AnswerD

This is the dedicated command for viewing rollout history. It lists revisions (e.g., 'REVISION CHANGE-CAUSE'), showing each revision number and the change cause (if annotations are set). It reads the revision history stored in the Deployment's ReplicaSets. This command is specifically designed for that purpose.

Why this answer

`kubectl rollout history deployment web` is the dedicated command to display the revision history of a Deployment, including revision numbers and change-cause annotations. This command directly queries the Deployment's rollout state from the Kubernetes API server, showing each revision's metadata.

Exam trap

The trap here is that candidates confuse `rollout status` (which shows current progress) with `rollout history` (which shows past revisions), or assume `describe` or `get -o yaml` would include historical data when they only show the current state.

How to eliminate wrong answers

Option A is wrong because `kubectl rollout status deployment web` shows the current rollout progress (e.g., waiting for pods to become ready), not the historical list of revisions. Option B is wrong because `kubectl get deployment web -o yaml` outputs the full YAML manifest of the current Deployment spec, not the rollout history. Option C is wrong because `kubectl describe deployment web` provides a summary of the current Deployment state, including events and conditions, but does not list past revisions or rollout history.

89
MCQmedium

During a rolling update, you want to ensure that a maximum of 2 extra pods are created above the desired replicas. Which field should you set in the Deployment spec?

A.spec.template.spec.containers.resources
B.spec.strategy.rollingUpdate.maxSurge
C.spec.replicas
D.spec.strategy.rollingUpdate.maxUnavailable
AnswerB

`spec.strategy.rollingUpdate.maxSurge` is the correct field because it directly controls the maximum number of pods that can be created above the desired `replicas` value during a rolling update. It allows the Deployment to temporarily overshoot the steady-state replica count to ensure new pods become ready before old ones are terminated, thereby maintaining capacity. For example, `maxSurge: 1` permits one extra pod beyond the desired count, while `maxSurge: 25%` allows a percentage-based overshoot.

Why this answer

B is correct because `spec.strategy.rollingUpdate.maxSurge` controls the maximum number of pods that can be created above the desired replica count during a rolling update. Setting `maxSurge` to 2 (or an absolute value of 2) ensures that at most 2 extra pods are created beyond the desired replicas, allowing the update to proceed with controlled parallelism.

Exam trap

The trap here is that candidates confuse `maxSurge` (extra pods above desired) with `maxUnavailable` (pods below desired), often selecting `maxUnavailable` when the question asks about creating extra pods.

How to eliminate wrong answers

Option A is wrong because `spec.template.spec.containers.resources` defines CPU and memory requests/limits for containers, not rolling update behavior. Option C is wrong because `spec.replicas` sets the desired number of pods but does not control how many extra pods can be created during an update. Option D is wrong because `spec.strategy.rollingUpdate.maxUnavailable` controls the maximum number of pods that can be unavailable during the update, not the number of extra pods above the desired count.

90
MCQeasy

Which kubectl command shows the rollout history of a Deployment named 'app'?

A.kubectl rollout status deployment app
B.kubectl describe deployment app
C.kubectl rollout history deployment app
D.kubectl get events --field-selector involvedObject.kind=Deployment
AnswerC

The `kubectl rollout history deployment app` command is the dedicated subcommand that displays the rollout history for a Deployment, showing an ordered list of revisions, each with its revision number and, if specified, the change cause from the `kubernetes.io/change-cause` annotation. This output directly reveals how the Deployment has evolved over time, making it the correct choice for viewing rollout history. Additionally, you can use the `--revision` flag to inspect a specific historical revision's detailed configuration.

Why this answer

`kubectl rollout history deployment app` is the specific command designed to display the revision history of a Deployment, including revision numbers and, if configured, the change-cause annotation. This command retrieves the stored rollout history from the Deployment's annotation `deployment.kubernetes.io/revision` and lists all previous ReplicaSets that were created during rollouts.

Exam trap

The trap here is that candidates confuse `rollout status` (which shows current progress) with `rollout history` (which shows past revisions), or they assume `describe` or `get events` would provide the same historical data, but neither command offers the structured revision list that `rollout history` does.

How to eliminate wrong answers

Option A is wrong because `kubectl rollout status deployment app` shows the current status of a rollout (e.g., whether it is progressing or complete), not the historical record of revisions. Option B is wrong because `kubectl describe deployment app` provides the current state and configuration of the Deployment, including its current revision, but does not list the full history of previous rollouts. Option D is wrong because `kubectl get events --field-selector involvedObject.kind=Deployment` retrieves cluster events related to Deployments, which may include rollout events but does not provide a structured, revision-based history of the Deployment's rollouts.

91
Multi-Selectmedium

Which THREE of the following are valid reasons to use a HorizontalPodAutoscaler (HPA) with a Deployment?

Select 3 answers
A.To set a fixed 'targetCPUUtilizationPercentage' that scales down the deployment when exceeded.
B.To scale replicas based on the number of incoming HTTP requests per second.
C.To scale replicas based on custom metrics exposed by the application.
D.To ensure that each pod has at least a certain amount of CPU resources reserved.
E.To automatically scale the number of replicas based on average CPU utilization across pods.
AnswersB, C, E

This is a valid use case for HPA, implemented through custom metrics. By exposing HTTP request counters from the application (e.g., via Prometheus) and registering a custom metrics adapter, HPA can query a metric like `http_requests_per_second` and scale replicas proportionally. The `autoscaling/v2` API allows referencing this custom metric via the `type: Object` or `type: Pods` metric source, making request-driven scaling a common real-world pattern.

Why this answer

Options B, C, and E are valid uses of a HorizontalPodAutoscaler (HPA). HPA can scale based on custom metrics (e.g., HTTP requests per second) via the 'custom' or 'external' metric types, making B and C correct. Option E is correct because HPA can scale based on average CPU utilization using the 'ResourceMetric' type with 'targetAverageUtilization'.

Option A is incorrect: HPA scales up when CPU exceeds the target, not down; also, the deprecated 'targetCPUUtilizationPercentage' field has been replaced by a metrics array. Option D is incorrect: HPA does not enforce resource requests; it only uses them as a basis for metric calculation.

92
MCQeasy

When performing a rolling update of a Deployment with 'maxSurge: 1' and 'maxUnavailable: 0', how many additional pods can be created above the desired replicas during the update?

A.1
B.0
C.Unlimited
D.100%
AnswerA

The correct value is 1 because maxSurge is defined as the number of additional pods that can be created above the desired replica count during a rolling update. Setting maxSurge=1 means that while updating, the deployment may temporarily run one extra pod beyond the desired replicas, ensuring that new pods are available before old ones are terminated, thereby maintaining service availability without exceeding a small, controlled increase in resources.

Why this answer

maxSurge defines the maximum number of pods that can be created above the desired replicas. With maxSurge=1, exactly one extra pod can exist during the update.

93
MCQmedium

You want to use Kustomize to apply a patch to a Deployment in the 'overlays/production' directory. Which command should you run from the kustomization directory?

A.kubectl create -k overlays/production/
B.kubectl apply -k overlays/production/
C.kustomize build overlays/production/ | kubectl apply -f -
D.kubectl apply -f overlays/production/
AnswerB

`kubectl apply -k overlays/production/` is the correct declarative approach because the `-k` flag tells kubectl to treat the directory as a kustomization root, build the resource set defined in `kustomization.yaml`, and send the resulting resources to the API server for apply. It is a single command that natively leverages the kustomize build process inside kubectl, exactly matching the requirement to use kustomize to patch a deployment. This is the canonical way to apply an overlay in modern kubectl without extra tools or piping.

Why this answer

`kubectl apply -k` is the standard command to apply a Kustomize overlay directly from a directory. It instructs kubectl to process the kustomization.yaml file in the specified path, build the final Kubernetes resources with all patches and transformations applied, and then apply them to the cluster. This is the idiomatic way to use Kustomize with kubectl in a production overlay scenario.

Exam trap

The trap here is that candidates confuse `kubectl apply -k` with `kubectl apply -f` or `kustomize build`, not realizing that `-k` is the native Kustomize flag for kubectl and that `-f` does not process kustomization.yaml files.

How to eliminate wrong answers

Option A is wrong because `kubectl create -k` does not exist; the `-k` flag is only supported with `apply`, not `create`. Option C is wrong because while `kustomize build overlays/production/ | kubectl apply -f -` would technically work, it is not the command to run from the kustomization directory — it requires piping and is less efficient than the direct `kubectl apply -k` command, which is the recommended approach in the CKAD exam. Option D is wrong because `kubectl apply -f` expects a raw YAML file, not a Kustomize overlay directory; it would fail to process the kustomization.yaml and apply the patches.

94
MCQmedium

You have a Helm chart for an application. You want to upgrade the release but only if the upgrade does not introduce breaking changes. Which command should you use?

A.helm install --dry-run my-release ./mychart
B.helm upgrade --dry-run my-release ./mychart
C.helm rollback my-release 0
D.helm diff upgrade my-release ./mychart
AnswerB

`helm upgrade --dry-run` is the right choice because it previews the exact changes that an upgrade to `my-release` would apply by rendering the new templates and performing a three-way merge between the last release manifest, the live cluster state, and the desired chart output. It shows a diff of what will be created, updated, or deleted—without actually touching the cluster—so you can catch template errors, missing values, or resource conflicts. Unlike `install`, this command targets the existing release, making it the standard tool for safe upgrade validation.

Why this answer

`helm upgrade --dry-run` simulates the upgrade process and validates the chart against the cluster without actually applying changes. The `--dry-run` flag allows you to detect breaking changes (e.g., missing required values, API deprecations, or incompatible resource definitions) before committing to the upgrade, ensuring the release remains stable.

Exam trap

The trap here is that candidates confuse `--dry-run` with `--diff` or assume `helm diff upgrade` is a built-in command, but Helm's native dry-run is the only guaranteed way to simulate an upgrade without external plugins.

How to eliminate wrong answers

Option A is wrong because `helm install --dry-run` is used to simulate a new installation, not an upgrade; it does not compare the current release state with the new chart, so it cannot detect breaking changes introduced by an upgrade. Option C is wrong because `helm rollback my-release 0` reverts the release to revision 0 (which is invalid; revision numbers start at 1) and performs an actual rollback, not a dry-run check for breaking changes. Option D is wrong because `helm diff upgrade` is not a standard Helm command; the correct command for diffing is `helm diff upgrade` from the `helm-diff` plugin, but it is not built into Helm and requires separate installation, making it unsuitable for a guaranteed built-in solution.

95
MCQhard

You have a HorizontalPodAutoscaler (HPA) that targets CPU utilization at 50%. The current average CPU utilization is 80%. The HPA has a stabilization window of 300 seconds and a scale-down policy with a periodSeconds of 60. CPU utilization drops to 40%. How long will it take for the HPA to begin scaling down?

A.After 300 seconds
B.Immediately
C.After 60 seconds
D.After 360 seconds
AnswerA

The correct scale-down timing is 300 seconds because the HorizontalPodAutoscaler always applies the scale-down stabilization window before reducing replicas. This window, defaulting to 300 seconds, prevents the controller from reacting to short-lived CPU drops that might be transient, ensuring that the number of pods is only decreased after the low utilization is consistently observed. Once the stabilization window has passed, the HPA reevaluates the desired replica count and performs the scale-down.

Why this answer

The HPA will begin scaling down after 300 seconds because the stabilization window for scale-down is set to 300 seconds. During this window, the HPA evaluates all recommended replica counts and selects the highest one, effectively delaying any scale-down action until the window expires. Even though CPU dropped to 40% (below the 50% target), the stabilization window prevents premature scale-down.

Exam trap

CKAD often tests the distinction between stabilization windows and scaling policies — candidates confuse periodSeconds (policy evaluation frequency) with the stabilization window (look-back period) and incorrectly add them together.

How to eliminate wrong answers

Option B is wrong because the HPA does not scale down immediately — the stabilization window explicitly delays scale-down decisions to avoid flapping. Option C is wrong because 60 seconds is the periodSeconds of the scale-down policy, which controls how frequently the policy is evaluated, not how long the stabilization window lasts. Option D is wrong because 360 seconds incorrectly adds the stabilization window (300s) and the periodSeconds (60s) — these are separate parameters and do not combine additively for the initial scale-down delay.

96
MCQhard

During a rolling update of a Deployment, you notice that new pods are failing readiness probes. The rollout is stalled. Which command would you use to abort the rollout and revert to the previous revision?

A.kubectl rollout undo deployment <name>
B.kubectl rollout pause deployment <name>
C.kubectl rollout resume deployment <name>
D.kubectl delete deployment <name> --cascade=false
AnswerA

The kubectl rollout undo deployment <name> command reverts a Deployment to its previous revision by scaling down the current ReplicaSet and scaling up the prior ReplicaSet according to the stored rollout history. This updates the pod template to the old spec, effectively reversing the changes made by the rolling update. Use --to-revision to target a specific revision, otherwise it selects the last available revision.

Why this answer

'kubectl rollout undo deployment <name>' reverts the rollout to the previous revision. Option A is correct.

97
MCQmedium

You have an HPA that scales a Deployment based on CPU utilization. You want to prevent the Deployment from scaling down for at least 5 minutes. Which HPA behavior field should you configure?

A.behavior.scaleUp.policies[0].periodSeconds
B.behavior.scaleDown.stabilizationWindowSeconds
C.behavior.scaleUp.stabilizationWindowSeconds
D.behavior.scaleDown.policies[0].periodSeconds
AnswerB

Setting behavior.scaleDown.stabilizationWindowSeconds configures the HPA to remember the desired replica counts from the last N seconds and, when scaling down, to use the maximum of those historical values instead of the newest recommendation. This creates the cooldown effect: after CPU utilization falls, the controller will not immediately shrink to the new lower desired count; it will only step down once the higher value ages out of the window. This prevents rapid, oscillating scale-downs during transient load dips and is exactly the field needed to avoid premature replica reduction.

Why this answer

To prevent scaling down, you can set a stabilization window on the scaleDown policy. Option B correctly sets a stabilizationWindowSeconds in the scaleDown behavior.

98
MCQmedium

What is the purpose of the 'maxUnavailable' field in a Deployment's rolling update configuration?

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

This is the correct definition. The maxUnavailable field in a Deployment's rolling update strategy sets the maximum number of Pods that can be unavailable relative to the desired replicas during the update process. It guarantees that a sufficient number of Pods remain running to serve traffic, with the default of 25% ensuring at least 75% availability.

Why this answer

The 'maxUnavailable' field in a Deployment's rolling update configuration specifies the maximum number of Pods that can be unavailable during the update process, relative to the desired replica count. This ensures that a controlled number of Pods are taken down at a time, maintaining application availability while the update progresses. It is defined as either an absolute number or a percentage of the desired replicas, and it works in conjunction with 'maxSurge' to control the update pace.

Exam trap

The trap here is that candidates often confuse 'maxUnavailable' with 'maxSurge' or assume it controls the termination rate, but the CKAD exam tests the precise definition that it limits the number of Pods that can be in an unavailable state during the update, not the number created above desired or the termination speed.

How to eliminate wrong answers

Option A is wrong because it describes the 'maxSurge' field, which controls the maximum number of Pods that can be created above the desired replicas, not 'maxUnavailable'. Option C is wrong because there is no 'maxUnavailable' field for time limits; Kubernetes uses 'progressDeadlineSeconds' for update timeout, not 'maxUnavailable'. Option D is wrong because while 'maxUnavailable' indirectly limits simultaneous terminations, it specifically caps the number of unavailable Pods (including those being terminated), not the number of Pods terminated simultaneously—Kubernetes handles termination in a rolling fashion based on availability constraints.

99
Multi-Selecthard

You have a Deployment 'web-app' with 4 replicas. You want to perform a rolling update such that during the update, at most 2 pods can be unavailable and at most 5 pods can be above the desired replica count. Which TWO of the following strategy configurations achieve this?

Select 2 answers
A.maxSurge: 3, maxUnavailable: 3
B.maxSurge: 5, maxUnavailable: 0
C.maxSurge: 5, maxUnavailable: 2
D.maxSurge: '125%', maxUnavailable: '50%'
E.maxSurge: 1, maxUnavailable: 2
AnswersC, D

Correct because maxSurge: 5 allows up to 5 extra pods, and maxUnavailable: 2 allows up to 2 unavailable, matching the requirement.

Why this answer

MaxSurge: 5 and maxUnavailable: 2 means during the rolling update, up to 2 pods can be unavailable (below the desired 4) and up to 5 extra pods can be created above the desired count, allowing a total of 9 pods at peak. This satisfies the requirement that at most 2 pods are unavailable and at most 5 pods are above the desired replica count. Option D is correct because 125% of 4 equals 5, and 50% of 4 equals 2, so the effective limits are the same as option C.

Option B is incorrect because maxUnavailable: 0 prevents any pod from becoming unavailable during the update, making it impossible to delete old pods without violating the constraint. A rolling update requires some pods to become temporarily unavailable when they are terminated; with maxUnavailable=0, the update cannot proceed because no pod can be terminated. Thus, the configuration does not achieve a successful rolling update.

Options A and E are incorrect because they allow more than 2 pods unavailable (A: maxUnavailable=3) or allow only 1 extra pod (E: maxSurge=1), not the required 5.

Exam trap

The CKAD exam often tests the distinction between absolute and percentage values for maxSurge and maxUnavailable, and the trap here is that candidates may incorrectly assume percentages are always rounded down or that both values must be integers, missing that '125%' and '50%' produce the same effective limits as 5 and 2 for a 4-replica deployment.

100
MCQeasy

Which kubectl command sets the number of replicas for a deployment named 'nginx' to 5?

A.kubectl update deployment nginx --replicas=5
B.kubectl scale deployment nginx --replicas=5
C.kubectl set scale deployment nginx --replicas=5
D.kubectl resize deployment nginx --replicas=5
AnswerB

kubectl scale deployment nginx --replicas=5 is the correct command because the scale subcommand directly adjusts the desired replica count for a Deployment, updating spec.replicas in the live object. It also accepts optional flags like --current-replicas to perform optimistic concurrency checks and --timeout to wait for the scale operation to complete. This is the standard imperative way to resize a Deployment's pod count in Kubernetes.

Why this answer

kubectl scale is the correct command to change the replica count of a deployment.

101
Multi-Selecthard

Which THREE of the following are true about using 'kubectl rollout undo'? (Select three)

Select 3 answers
A.It rolls back to the previous revision by default
B.It can roll back to a specific revision using the --to-revision flag
C.It pauses the current rollout
D.It can be used on DaemonSets
E.It deletes the current Deployment and recreates it from scratch
AnswersA, B, D

When you run kubectl rollout undo with no flags, Kubernetes automatically selects the last available revision from the workload's rollout history and applies that configuration to replace the current pod template. This is a single-step revert that undoes only the most recent change, leaving older revisions untouched. If you need to return to an earlier state, you must explicitly specify --to-revision.

Why this answer

'kubectl rollout undo' without any flags reverts a Deployment to the previous revision (revision N-1) by default. This is the standard behavior for rollback operations in Kubernetes, where each change to a Deployment's pod template creates a new revision in the rollout history.

Exam trap

The trap here is that candidates confuse 'rollout undo' with 'rollout pause' or assume it destroys the Deployment, when in fact it only reverts the pod template to a previous revision while keeping the Deployment object intact.

102
MCQhard

A Deployment named 'web' has replicas: 3 and update strategy type: Recreate. You run 'kubectl set image deployment/web web=nginx:1.22'. What immediate effect will this have on the existing pods?

A.One pod is terminated, then a new pod is created, repeating until all are updated.
B.The command fails because Recreate does not support image updates.
C.All existing pods are terminated simultaneously, then new pods are created.
D.The pods are updated in place without termination.
AnswerC

With the Recreate update strategy, the Deployment controller first terminates all existing Pods from the old ReplicaSet, then creates the new Pods from the updated ReplicaSet. For replicas: 3, all three old Pods are shut down before any new Pod is scheduled, resulting in a complete but brief period of unavailability. This is the correct behavior of Recreate.

Why this answer

The Deployment's update strategy type is set to 'Recreate', which means all existing pods are terminated simultaneously before any new pods are created. When you run 'kubectl set image deployment/web web=nginx:1.22', it triggers a rollout that follows the Recreate strategy: first, all current pods are deleted, then the new pods are created with the updated image. This is in contrast to the RollingUpdate strategy, which updates pods gradually.

Exam trap

The trap here is that candidates often confuse the Recreate strategy with a rolling update, assuming pods are updated one by one, or mistakenly think Recreate prevents image updates entirely.

How to eliminate wrong answers

Option A is wrong because it describes a rolling update behavior (one pod at a time), which is characteristic of the RollingUpdate strategy, not Recreate. Option B is wrong because Recreate does support image updates; the strategy simply dictates how the update is performed, not whether it is allowed. Option D is wrong because pods are not updated in place; Kubernetes always terminates and recreates pods when the image changes, regardless of the update strategy.

103
MCQmedium

A pod is running but not responding to requests. The developer suspects the liveness probe is misconfigured. Which command can they use to check the probe configuration of a running pod?

A.kubectl logs <pod-name>
B.kubectl describe pod <pod-name>
C.kubectl exec <pod-name> -- env
D.kubectl get pod <pod-name>
AnswerB

kubectl describe pod displays the pod's full specification in a human-readable format, including each container's livenessProbe, readinessProbe, and startupProbe with their exact HTTP paths, ports, initialDelaySeconds, periodSeconds, failureThreshold, and timeoutSeconds. It also surfaces recent events, such as 'Liveness probe failed,' which directly indicate why the pod is unresponsive. This is the definitive command for inspecting probe configuration and diagnosing probe-related responsiveness issues.

Why this answer

`kubectl describe pod <pod-name>` displays the full pod specification, including the liveness probe configuration (e.g., `Liveness: http-get /healthz delay=0s timeout=1s period=10s #success=1 #failure=3`). This allows the developer to verify the probe type, endpoint, initial delay, timeout, and failure threshold directly from the running pod's definition.

Exam trap

The trap here is that candidates confuse `kubectl logs` (which shows runtime output) with `kubectl describe` (which shows configuration), assuming logs would reveal probe failures, but logs only show application output, not the probe definition itself.

How to eliminate wrong answers

Option A is wrong because `kubectl logs` shows the container's stdout/stderr output, not the pod's configuration or probe settings; it cannot reveal how the probe is defined. Option C is wrong because `kubectl exec -- env` prints environment variables inside the container, which are unrelated to the liveness probe configuration stored in the pod spec. Option D is wrong because `kubectl get pod` only shows a summary (name, status, restarts, age) and does not include detailed probe parameters like path, port, or thresholds.

104
Multi-Selectmedium

You are using Helm to manage a chart. Which commands are valid to list installed releases? (Choose TWO)

Select 2 answers
A.helm ls
B.helm upgrade
C.helm status
D.helm history
E.helm list
AnswersA, E

helm ls is correct because it is a built-in alias for the `helm list` command, which enumerates all deployed Helm releases in your current Kubernetes namespace. When run, it queries Helm's release storage (typically Secrets or ConfigMaps) and displays a table with release name, status, revision, and chart details. The shorthand form is widely used in scripts and everyday operations, making it a convenient equivalent to the command that the question asks about.

Why this answer

`helm ls` and `helm list` are both valid commands to list installed releases in Helm. `helm ls` is an alias for `helm list`, and both display all deployed releases in the current namespace by default. These commands are essential for managing Helm-based deployments.

Exam trap

The CKAD exam often tests the alias relationship between `helm ls` and `helm list`, and candidates may mistakenly think only one is valid or confuse `helm list` with `helm history` which shows revision history for a single release.

105
MCQmedium

A company wants to deploy a stateful database cluster where each pod has its own persistent storage. They need stable network identities and ordered pod creation. Which resource should they use?

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

StatefulSet is the correct controller because it assigns each pod a stable, ordinal hostname (e.g., db-0, db-1) backed by a Headless Service, so cluster members can discover each other deterministically. Its volumeClaimTemplates provision a unique PersistentVolumeClaim for every replica, ensuring data survives restarts. StatefulSet also supports ordered, graceful deployment and scaling, which matches the initialization and quorum requirements of stateful databases.

Why this answer

StatefulSet is the correct resource because it provides stable, unique network identities (via headless Services and ordinal hostnames) and ordered, graceful deployment and scaling (pod creation/deletion in sequence). This matches the requirements for a stateful database cluster where each pod requires its own PersistentVolumeClaim (PVC) and stable identity for clustering.

Exam trap

CNCF often tests the misconception that Deployment can handle stateful workloads by using PersistentVolumeClaims, but they fail to recognize that Deployment lacks stable network identities and ordered pod management, which are critical for database clustering.

How to eliminate wrong answers

Option A is wrong because Deployment does not guarantee stable network identities or ordered pod creation; pods are treated as ephemeral and interchangeable, which is unsuitable for stateful applications requiring persistent storage per pod. Option C is wrong because CronJob is designed for scheduled, batch jobs (running to completion) and does not manage long-running stateful pods with persistent storage or stable identities. Option D is wrong because DaemonSet ensures one pod per node, not ordered creation or per-pod persistent storage; it is intended for node-level services like logging or monitoring, not stateful databases.

106
MCQeasy

A developer needs to deploy a container that runs a batch job to process data once and then exit. The job should be restarted only if it fails. Which Kubernetes resource should be used?

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

A Job creates one or more pods and tracks them until a specified number of successful completions are reached, which exactly matches the semantics of a batch operation. The Job controller uses a restart policy of Never or OnFailure, and it implements backoff limits, active deadlines, parallelism, and completion counts to govern how failed pods are retried. This allows the developer to express 'run this container once' and have Kubernetes guarantee the task eventually ends in a completed state, or fail according to policy. Hence, for a container that runs a batch job and exits, Job is the correct workload controller.

Why this answer

A Kubernetes Job is the correct resource for a batch workload that runs to completion and exits. It ensures the pod is restarted only on failure (via the `RestartPolicy: OnFailure` or `Never`), which matches the requirement of restarting only if the job fails. Deployments and DaemonSets are designed for long-running processes, not termination.

Exam trap

The trap here is that candidates often confuse a Job with a Deployment because both can run containers, but a Deployment is designed for long-running services and will restart pods even on successful completion, which violates the 'run once' requirement.

How to eliminate wrong answers

Option A is wrong because a DaemonSet ensures one pod runs on every node and is intended for continuous daemon processes (e.g., log collectors), not for batch jobs that exit. Option B is wrong because a Deployment manages a set of pods that should run indefinitely, maintaining a desired replica count; it will restart pods regardless of exit reason, which does not match the 'restart only on failure' requirement. Option D is wrong because a StatefulSet is for stateful applications requiring stable network identities and persistent storage, not for ephemeral batch processing.

107
MCQhard

A Deployment has replicas: 3 and uses a ConfigMap. The ConfigMap is updated. The developer wants to update the pods to use the new ConfigMap without recreating the Deployment. What is the correct approach?

A.kubectl rollout restart deployment/<name>
B.kubectl set image deployment/<name> <container>=<new-image>
C.The pods automatically mount the new ConfigMap within seconds
D.Delete and recreate each pod manually
AnswerA

kubectl rollout restart deployment/<name> is correct because it modifies the pod template's annotation (spec.template.metadata.annotations) without changing container images, forcing the Deployment controller to create a new ReplicaSet and perform a rolling update. New pods are scheduled with the patched template and therefore mount the latest ConfigMap data at container start, while old pods are terminated gradually. This is the recommended declarative way to reload configuration changes with zero downtime and full rollout history.

Why this answer

A `kubectl rollout restart deployment/<name>` triggers a rolling restart of the Pods managed by the Deployment. Since ConfigMaps are mounted as volumes or injected as environment variables at Pod creation time, the only way to pick up updated ConfigMap data without recreating the Deployment object itself is to force the existing Pods to be terminated and recreated. The Deployment controller handles this gracefully, ensuring zero downtime by following the configured rolling update strategy.

Exam trap

The trap here is that candidates assume ConfigMaps are dynamically updated in running Pods (Option C), but in reality, Pods must be recreated to consume updated ConfigMap data unless the application explicitly watches for file changes.

How to eliminate wrong answers

Option B is wrong because `kubectl set image` updates the container image, not the ConfigMap; it does not cause Pods to reload ConfigMap data. Option C is wrong because ConfigMaps are not automatically updated inside running Pods — they are snapshotted at Pod start; even if the volume is mounted as a subPath or as environment variables, the Pod must be restarted to reflect changes. Option D is wrong because manually deleting and recreating Pods is error-prone, does not leverage the Deployment’s rollout history or update strategy, and violates the principle of declarative management; the correct imperative command is `kubectl rollout restart`.

108
MCQeasy

You have a Deployment named 'web-app' with 5 replicas. You run the command: kubectl set image deployment/web-app web-app=nginx:1.25. Which command can you use to monitor the progress of the rollout?

A.kubectl describe deployment/web-app
B.kubectl rollout history deployment/web-app
C.kubectl rollout status deployment/web-app
D.kubectl get events --watch
AnswerC

kubectl rollout status deployment/web-app attaches to the Deployment's status and blocks until the rollout reaches completion, printing progress messages like 'Waiting for deployment spec update...' and finally 'deployment "web-app" successfully rolled out'. It returns a non-zero exit code if the rollout times out or fails, making it the canonical command for checking rollout success. It also supports a `--timeout` flag to bound the wait, which is essential in scripts and CI pipelines.

Why this answer

`kubectl rollout status deployment/web-app` is the dedicated command to monitor the progress of a rollout, providing real-time updates on whether the rollout is succeeding, pending, or failed. It watches the deployment's status conditions and reports when the new ReplicaSet has fully replaced the old one, making it the precise tool for tracking the progress of the `kubectl set image` change.

Exam trap

The trap here is that candidates confuse `kubectl rollout status` with `kubectl rollout history` or `kubectl describe`, mistakenly thinking a static view or revision list can show live progress, when only `rollout status` provides real-time monitoring of the rollout's completion.

How to eliminate wrong answers

Option A is wrong because `kubectl describe deployment/web-app` shows the current state and configuration of the deployment, including the rollout strategy and conditions, but it does not actively monitor or stream progress; it only provides a static snapshot. Option B is wrong because `kubectl rollout history deployment/web-app` displays the revision history of the deployment (e.g., revision numbers and change causes), but it does not show the current rollout status or progress. Option D is wrong because `kubectl get events --watch` streams all cluster events, which is too broad and noisy; while it may include rollout-related events, it is not a focused or efficient way to monitor the specific rollout progress of the deployment.

109
Multi-Selectmedium

Which TWO commands can be used to update the image of a Deployment? (Select two)

Select 2 answers
A.kubectl set image deployment/myapp app=nginx:1.21
B.kubectl edit deployment myapp
C.kubectl update deployment myapp --image=nginx:1.21
D.kubectl patch deployment myapp -p '{"spec":{"template":{"spec":{"containers":[{"name":"app","image":"nginx:1.21"}]}}}}'
E.kubectl replace deployment myapp --image=nginx:1.21
AnswersA, D

This command is correct because it imperatively modifies the container's image using the syntax `deployment/<name> <container>`=`<new-image>`. It directly patches the live Deployment object and triggers a rollout if the pod template changes. It is the most concise and readable way to update an image for a single Deployment, which is why it is commonly used in CI/CD pipelines.

Why this answer

Options A and D are correct because `kubectl set image` directly updates the container image, and `kubectl patch` modifies the Deployment manifest using a JSON patch. Option B is incorrect because `kubectl edit` only opens the manifest in an editor, requiring manual changes; it does not directly update the image. Option C is incorrect because `kubectl update` is not a valid command.

Option E is incorrect because `kubectl replace` requires a full manifest file, not just an image flag.

Exam trap

The CKAD exam often tests the distinction between valid imperative commands (`set image`, `edit`, `patch`) and invalid or misused commands (`update`, `replace` with wrong flags), so candidates must remember that `kubectl update` does not exist and `kubectl replace` requires a full manifest, not a flag-based update.

110
MCQhard

You have a Deployment that is currently paused. You want to resume the rollout and then check the status of the rollout. Which set of commands should you run?

A.kubectl rollout pause deployment/myapp && kubectl rollout status deployment/myapp
B.kubectl rollout resume deployment/myapp && kubectl rollout history deployment/myapp
C.kubectl rollout undo deployment/myapp && kubectl rollout status deployment/myapp
D.kubectl rollout resume deployment/myapp && kubectl rollout status deployment/myapp
AnswerD

The correct sequence is `kubectl rollout resume` to unpause the deployment, letting the deployment controller continue the rolling update from where it left off, followed by `kubectl rollout status` to poll the rollout until it completes or reports an error. The status command blocks until the rollout condition is successful, giving immediate and accurate feedback on the health of the deployment. This directly addresses the user's intent: resume the paused deployment and confirm it reaches the desired state.

Why this answer

First, resume the rollout with 'kubectl rollout resume deployment/<name>', then check status with 'kubectl rollout status deployment/<name>'. Option D is correct. Option B uses 'kubectl rollout history' which shows revision history, not current status.

111
MCQeasy

What is the difference between 'kubectl apply' and 'kubectl create'?

A.'kubectl apply' only works with Deployments, while 'kubectl create' works with all resources
B.'kubectl apply' is for creating resources, 'kubectl create' is for updating
C.There is no difference
D.'kubectl apply' can be used to create and update resources; 'kubectl create' only creates new resources
AnswerD

This is correct: 'kubectl apply' provides declarative management—it creates a resource if absent and updates it if present by calculating a PATCH based on the object's live state and its stored last-applied configuration. 'kubectl create' is imperative and only performs an initial POST, failing with an error if the resource already exists. Because 'apply' knows the last-applied state, it supports partial updates, while 'create' does not.

Why this answer

'kubectl apply' is declarative: it creates or updates a resource to match the provided configuration. 'kubectl create' is imperative: it creates a new resource and will fail if the resource already exists.

112
MCQeasy

Which commands list all Helm releases in the current namespace? (Select all that apply)

A.helm list
B.helm get all
C.helm ls
D.helm status
AnswerA, C

`helm list` is the canonical Helm verb for enumerating releases in the current Kubernetes namespace. It queries Helm's stored release records (Secrets/ConfigMaps tagged with helm.sh/release.v1) and displays columns for release name, status, chart version, app version, and namespace, with options like `--all-namespaces` (`-A`) to expand scope and `--short` to print names only. Without `-A`, it respects the default namespace from kubeconfig or the `--namespace` flag.

Why this answer

Both `helm list` and its alias `helm ls` are valid commands to list all Helm releases in the current namespace. `helm get all` retrieves all information about a specific release, and `helm status` shows the status of a single release.

Exam trap

The CKAD exam tests that you know both `helm list` and its alias `helm ls` are acceptable. The trap is thinking only one is correct when both work. This is a multi-select question.

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 manifests of a specific release is `helm get manifest <release>`. Option C is wrong because while `helm ls` is a valid alias for `helm list` and would technically work, the question asks for the command that lists releases, and `helm ls` is simply a shorthand, not the primary command name; however, in the context of this question, both A and C are functionally correct, but the exam expects `helm list` as the canonical answer. Option D is wrong because `helm status` displays detailed status information for a single named release, not a list of all releases.

113
MCQhard

During a canary deployment, you want to send 10% of traffic to the new version. You have two Deployments: 'app-stable' (version: stable) and 'app-canary' (version: canary). You use a Service with label selector 'app: myapp' and a second selector for version. How can you achieve the 10% traffic split?

A.Use an Ingress controller that supports canary deployments or a service mesh
B.Use a Service with multiple ports
C.Set the Service's sessionAffinity to distribute load
D.Scale app-canary to 1 replica and app-stable to 9 replicas, and use a single Service that selects both
AnswerA

Ingress controllers such as NGINX Ingress expose canary-specific annotations (e.g., nginx.ingress.kubernetes.io/canary-weight) that allow precise, percentage-based traffic splitting between two backend Services, while a service mesh like Istio provides similar fine-grained control through VirtualService and DestinationRule resources. This approach operates at the L7 routing layer, so it can deterministically send exactly 10% of requests to the canary version instead of relying on heuristics like replica counts or connection persistence.

Why this answer

Kubernetes Services alone cannot perform weighted traffic splitting based on replica counts; they use round-robin load balancing at the pod level. To achieve a precise 10% traffic split, you need an Ingress controller (e.g., NGINX Ingress with canary annotations) or a service mesh (e.g., Istio with VirtualService) that supports weighted routing between two different Services or subsets. This allows you to direct a specific percentage of traffic to the canary version independently of replica counts.

Exam trap

A common pitfall is the misconception that scaling replicas in proportion to desired traffic split (e.g., 1 canary and 9 stable) will automatically give a 10% traffic split via a single Service. However, Kubernetes Service load balancing is not weighted by replica count and does not guarantee precise percentages.

How to eliminate wrong answers

Option B is wrong because multiple ports on a Service are used to expose different container ports, not to split traffic between different versions of an application. Option C is wrong because sessionAffinity (e.g., ClientIP) ensures a client sticks to the same pod, but it does not control the proportion of traffic sent to different versions; it only affects session persistence. Option D is wrong because a single Service with a selector that matches both Deployments (e.g., 'app: myapp') will distribute traffic equally among all matching pods via round-robin, regardless of replica counts; the Service does not weight traffic by replica numbers, so 1 canary pod and 9 stable pods would still result in roughly 10% of requests hitting the canary only if the load balancer is perfectly random, but Kubernetes Service does not guarantee a precise percentage and can vary with request timing and pod readiness.

114
MCQmedium

A Helm chart is installed with the command 'helm install myapp ./mychart'. You need to upgrade the release with new values from a file 'prod-values.yaml'. Which command is correct?

A.helm upgrade myapp ./mychart --values prod-values.yaml
B.helm upgrade ./mychart prod-values.yaml --release myapp
C.helm upgrade --install myapp ./mychart -f prod-values.yaml
D.helm upgrade myapp -f prod-values.yaml
AnswerA

Helm's upgrade subcommand follows the positional contract `helm upgrade [RELEASE] [CHART]`, so `myapp` is the release being upgraded and `./mychart` is the chart to deploy. The `--values prod-values.yaml` flag (or `-f`) passes the production overrides file, which is merged into the release's configuration. This is the exact, minimal, and idempotent command for upgrading an existing release named `myapp` from the local chart directory using the specified values file.

Why this answer

`helm upgrade myapp ./mychart --values prod-values.yaml` explicitly specifies the release name (`myapp`), the chart path (`./mychart`), and the values file (`--values prod-values.yaml`). This is the standard syntax for upgrading a Helm release with custom values, where `--values` (or `-f`) merges the provided YAML file over the default chart values.

Exam trap

The CKAD exam often tests the exact positional syntax of Helm commands, and the trap here is that candidates may forget that `helm upgrade` requires both the release name and the chart path as positional arguments, leading them to pick options that omit the chart path (like D) or misplace arguments (like B).

How to eliminate wrong answers

Option B is wrong because it incorrectly places the chart path (`./mychart`) before the values file and uses `--release myapp` instead of the positional release name argument; Helm expects the release name as the first argument after `upgrade`, not a flag. Option C is wrong because `--install` is unnecessary for an upgrade (it would create the release if missing, but the question only asks to upgrade an existing release) and the command still works but is not the minimal correct answer; however, the primary issue is that it adds an extra flag not required by the scenario. Option D is wrong because it omits the chart path (`./mychart`), which is mandatory for `helm upgrade` to know which chart to apply; without it, Helm will fail with an error about missing chart reference.

115
Multi-Selecteasy

Which TWO of the following are valid non-interactive methods to update a Deployment's image?

Select 2 answers
A.kubectl replace -f deployment.yaml
B.kubectl edit deployment/myapp and change the image field
C.kubectl rollout image deployment/myapp mycontainer=nginx:1.21
D.kubectl set image deployment/myapp mycontainer=nginx:1.21
E.kubectl create -f deployment.yaml
AnswersA, D

kubectl replace with an updated YAML file is a declarative update: it submits the entire Deployment manifest to the API server, replacing the existing resource representation. This is a valid method because the file contains the new image, and the server applies it atomically. It differs from set image in that you must provide a full manifest rather than a targeted field change.

Why this answer

Option A (kubectl replace -f deployment.yaml) is correct because replace applies a full manifest non-interactively, so if the YAML file already contains the updated image, the Deployment's Pod template is replaced and a rollout is triggered without opening an editor. Option D (kubectl set image deployment/myapp mycontainer=nginx:1.21) is correct because kubectl set image is a purpose-built, non-interactive command that directly patches the named container's image in the Deployment spec, causing a new ReplicaSet rollout. Option B is not valid here because kubectl edit opens an interactive text editor, which contradicts the non-interactive requirement.

Option C is not valid because kubectl rollout does not have an 'image' subcommand; the correct subcommands are status, history, undo, restart, pause, and resume. Option E is not valid because kubectl create fails when the Deployment already exists and is not an update method.

Exam trap

CKAD often tests whether candidates confuse imperative update commands (`set image`, `replace`) with interactive ones (`edit`) or invent non-existent subcommands like `rollout image`.

116
MCQeasy

Which command is used to undo the most recent rollout of a Deployment named 'myapp'?

A.kubectl rollout undo deployment myapp
B.kubectl rollout undo deployment myapp --to-revision=2
C.kubectl rollout status deployment myapp
D.kubectl rollback deployment myapp
AnswerA

This command reverts the Deployment to its previous revision, making the prior pod template the current desired state. It works by creating a new ReplicaSet from the last configuration and using the rolling update strategy to replace the current ReplicaSet, thereby undoing the most recent rollout.

Why this answer

`kubectl rollout undo deployment myapp` reverts the Deployment to the previous revision by default, effectively undoing the most recent rollout. This command uses the rollout history stored in the Deployment's annotations (e.g., `deployment.kubernetes.io/revision`) to identify and apply the prior ReplicaSet.

Exam trap

The trap here is that candidates confuse `kubectl rollout undo` with the non-existent `kubectl rollback` command, or assume `--to-revision=2` always undoes the most recent rollout, when in fact it targets a specific revision regardless of recency.

How to eliminate wrong answers

Option B is wrong because `--to-revision=2` explicitly rolls back to revision 2, not necessarily the most recent rollout; if the most recent rollout was revision 3, this would undo to revision 2, not the immediate previous state. Option C is wrong because `kubectl rollout status deployment myapp` only checks the current rollout progress and does not perform any undo operation. Option D is wrong because `kubectl rollback` is not a valid kubectl command; the correct verb is `rollout undo`, and `rollback` is a legacy term from older orchestration tools like Docker Compose or Kubernetes API extensions.

117
MCQmedium

You are using Kustomize. Your kustomization.yaml file specifies a base and an overlay. You run: kubectl apply -k overlays/production. What happens?

A.It errors because -k expects a directory with kustomization.yaml.
B.It applies the base resources only.
C.It applies the merged result of base and overlay.
D.It applies the overlay resources only.
AnswerC

When you run kubectl apply -k overlays/production, kustomize reads the kustomization.yaml in that overlay directory, which typically lists the base directory as a resource. It then merges the base resources with overlay-specific patches, strategic merge patches, name prefixes, labels, or namespace changes, producing a single unified manifest set. This rendered output is sent to kubectl apply, which creates or updates the live cluster objects accordingly.

Why this answer

When you run `kubectl apply -k overlays/production`, Kustomize reads the `kustomization.yaml` in the specified directory, which references a base and an overlay. It then performs a strategic merge patch of the overlay's customizations (e.g., patches, namePrefix, commonLabels) onto the base resources, producing a single set of manifests that are applied to the cluster. This is the core purpose of Kustomize: to compose and customize resources without templating.

Exam trap

The trap here is that candidates might think `-k` applies only the contents of the specified directory (like `-f` does), but Kustomize always resolves the full overlay chain, including the base, so the result is a merged output, not just the overlay's files.

How to eliminate wrong answers

Option A is wrong because `-k` does not require a directory with a file named exactly `kustomization.yaml`; it expects a directory containing a `kustomization.yaml` (or `kustomization.yml` or `Kustomization`) file, and `overlays/production` is a valid directory that contains such a file. Option B is wrong because Kustomize always merges the overlay onto the base; it does not apply only the base resources when an overlay is specified. Option D is wrong because Kustomize does not apply only the overlay resources; it merges the overlay's modifications onto the base, and the base resources are always included in the final output.

118
MCQeasy

A developer is deploying a web application that requires 2 GiB of memory and 0.5 CPU cores. The cluster nodes have 4 GiB of memory and 2 CPU cores each. The developer wants to ensure the pod gets guaranteed QoS class. Which resource specification should be used?

A.requests: memory: 2Gi, cpu: 500m; no limits
B.requests: memory: 2Gi, cpu: 500m; limits: memory: 2Gi, cpu: 500m
C.requests: memory: 2Gi, cpu: 500m; limits: memory: 4Gi, cpu: 1
D.requests: memory: 1Gi, cpu: 250m; limits: memory: 2Gi, cpu: 500m
AnswerB

When memory and CPU requests are set identically to their limits, the pod belongs to the Guaranteed QoS class, which is the only class with the highest eviction priority. The node reserves exactly 2Gi of memory and 500m of CPU for scheduling, while the runtime caps actual usage at those same values, preventing memory overcommit and making the pod's resource behavior completely predictable. This matches the stated 2Gi requirement and ensures the application is never silently granted less or allowed to escape its quota.

Why this answer

For a pod to receive the Guaranteed QoS class, every container in the pod must have both resource requests and limits set, and the requests must equal the limits for each resource (memory and CPU). This configuration ensures the pod is not overcommitted and gets the highest priority under resource pressure.

Exam trap

The trap here is that candidates often think setting only requests (Option A) or setting limits higher than requests (Option C) still gives Guaranteed QoS, but Kubernetes strictly requires requests == limits for all resources to achieve Guaranteed class.

How to eliminate wrong answers

Option A is wrong because it sets only requests without limits, which places the pod in the Burstable QoS class (since limits are not set, the pod can burst above requests). Option C is wrong because the limits exceed the requests (memory 4Gi > 2Gi, CPU 1 > 500m), which also results in Burstable QoS, not Guaranteed. Option D is wrong because the requests are lower than the limits (memory 1Gi < 2Gi, CPU 250m < 500m), again yielding Burstable QoS; additionally, the requests do not match the developer's requirement of 2Gi memory and 500m CPU.

119
MCQmedium

You have just applied a new Deployment configuration using 'kubectl apply -f deployment.yaml'. You want to see the latest revision number of the rollout. Which command should you run?

A.kubectl rollout status deployment/myapp
B.kubectl get deployment myapp -o yaml
C.kubectl describe deployment myapp
D.kubectl rollout history deployment/myapp
AnswerD

kubectl rollout history deployment/myapp is the dedicated command for displaying the rollout history of a Deployment. It lists each revision number, the change-cause annotation (if set), and the revision timestamps, directly derived from the underlying ReplicaSets created by the Deployment controller. This command provides a concise, numbered table that lets you compare revisions and identify which revision to roll back to, making it the correct and most direct way to see revision numbers in a deployment.

Why this answer

'kubectl rollout history deployment/<name>' shows revision history with revision numbers. The latest revision is shown as the most recent.

120
MCQmedium

You have a Deployment 'web' with 'maxSurge: 25%' and 'maxUnavailable: 25%'. Current replicas is 4. You update the image. How many pods will be created at most during the rollout?

A.8
B.4
C.5
D.6
AnswerC

5 is correct because with a desired replica count of 4, the 25% maxSurge rounds up to exactly 1 additional pod. This brings the total possible pods during the rollout to 5 (4 desired + 1 surge), enabling the Deployment to create the new pod before scaling down the old ReplicaSet, thereby preserving availability.

Why this answer

With maxSurge: 25% and maxUnavailable: 25%, the maximum number of pods created during a rolling update is calculated as current replicas (4) plus the surge (25% of 4 = 1), resulting in up to 5 pods at any given time. The surge allows extra pods to be created before terminating old ones, ensuring availability while limiting the total to 5.

Exam trap

The trap here is that candidates often forget to add the surge pods to the current replica count, mistakenly thinking the surge replaces pods rather than being created in addition to them.

How to eliminate wrong answers

Option A is wrong because 8 pods would require a maxSurge of 100% (4 extra pods), not 25%. Option B is wrong because 4 pods ignores the surge entirely, assuming no extra pods are created during the rollout, which contradicts the maxSurge setting. Option D is wrong because 6 pods would require a maxSurge of 50% (2 extra pods), not 25%.

121
Multi-Selectmedium

Which TWO of the following are valid methods to perform a blue-green deployment in Kubernetes?

Select 2 answers
A.Use a Deployment with 'strategy.type: Recreate' and delete the old version before creating the new one.
B.Create a Deployment with two replicas and use a Service with session affinity to gradually shift traffic.
C.Use a Deployment with 'strategy.type: RollingUpdate' and set 'maxSurge: 100%' and 'maxUnavailable: 0%'.
D.Create two Services, one for blue and one for green. Initially point an ingress to the blue Service. Update the ingress to point to green after validation.
E.Create two Deployments with different labels (e.g., version: blue and version: green). Use a Service initially selecting blue. Update the Service selector to green after green is ready.
AnswersD, E

This is a valid blue-green pattern that uses two dedicated Services, one for each version, with an Ingress as the traffic switch. Initially the Ingress backend points to the blue Service; after the green version is fully tested and ready, you update the Ingress to route traffic to the green Service. This gives you a stable network endpoint for each environment and lets you roll back instantly by reverting the Ingress backend to blue. It is technically sound and demonstrates a clean separation between routing and application lifecycle.

Why this answer

Option D is correct because blue-green deployment requires two parallel environments and an atomic traffic switch: running separate blue and green Services and using an Ingress (or similar L7 router) to direct traffic to the blue Service, then updating the Ingress backend to the green Service after validation, achieves exactly that cutover without downtime. Option E is correct because two Deployments distinguished by labels (version: blue and version: green) with a Service whose selector initially matches blue, then is updated to match green once the green pods are Ready, is the canonical Kubernetes blue-green pattern using native Service selector switching. Option A is not blue-green because strategy.type: Recreate tears down the old version before starting the new one, causing downtime and providing no parallel green environment to validate.

Option B is not blue-green because session affinity on a single Service with two replicas does not create two distinct blue/green versions or an atomic traffic switch. Option C is not blue-green because a RollingUpdate with maxSurge: 100% and maxUnavailable: 0% is a progressive rollout of one version, not two coexisting environments with a controlled cutover.

Exam trap

CKAD often tests the misconception that a Deployment strategy (Recreate or RollingUpdate) constitutes blue-green, when in fact blue-green requires two parallel environments plus an atomic traffic switch via Service selector or Ingress backend.

122
Drag & Dropmedium

Order the steps to expose a Kubernetes Deployment as a ClusterIP Service.

Drag or tap steps into the slots.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

A Service requires a running Deployment. Define and apply the Service, then verify endpoints and test DNS resolution.

123
Multi-Selectmedium

Which TWO commands can be used to view the rollout history of a Deployment?

Select 2 answers
A.kubectl get deployment mydeployment
B.kubectl rollout status deployment/mydeployment
C.kubectl logs deployment/mydeployment
D.kubectl describe deployment mydeployment
E.kubectl rollout history deployment mydeployment
AnswersD, E

kubectl describe deployment mydeployment gives a detailed multi-section view that includes the Annotations block, notably the deployment.kubernetes.io/revision annotation, which records the current rollout revision. It also lists ReplicaSet names under the Status section and surfaces Events that document previous scaling or update actions, giving a narrative of the rollout history. This makes it a valid, though less structured, way to view rollout history information compared to the dedicated rollout history command.

Why this answer

`kubectl describe deployment mydeployment` includes the rollout history in its output, showing revision numbers and timestamps of changes. Option E is correct because `kubectl rollout history deployment/mydeployment` is the dedicated command to display the rollout history, listing revisions and associated change causes.

Exam trap

The trap here is that candidates confuse `kubectl rollout status` (which shows current rollout progress) with `kubectl rollout history` (which shows past revisions), or assume `kubectl describe` only shows current state, when in fact it includes the rollout history under the 'Conditions' and 'Events' sections.

124
Multi-Selecthard

Which THREE of the following are valid fields in a Helm chart's values.yaml file that can be used in templates?

Select 3 answers
A.replicaCount: 3
B.{{ .Chart.Name }}
C.{{- include "common.labels" . }}
D.service: type: ClusterIP port: 80
E.image: repository: nginx tag: latest
AnswersA, D, E

In Helm, values.yaml is a YAML file that supplies configuration defaults, and replicaCount is a conventional top-level scalar key (type integer). It is accessed in deployment templates via {{ .Values.replicaCount }} to set the replicas spec. This is valid because values.yaml accepts any YAML primitives, and Helm later merges this value with user-provided overrides such as --set replicaCount=5.

Why this answer

`replicaCount: 3` is a standard top-level key in a Helm chart's `values.yaml` file. This file contains plain YAML key-value pairs that are injected into templates via the `.Values` object (e.g., `{{ .Values.replicaCount }}`). It is not a template directive itself, but a data source for templates.

Exam trap

The trap here is that candidates confuse the content of `values.yaml` (plain YAML data) with Go template syntax used in template files, leading them to select options that contain `{{ }}` directives as if they were valid values.

125
MCQmedium

You need to perform a canary deployment where 10% of traffic goes to the new version. You have a Deployment 'app-v1' with 9 replicas and 'app-v2' with 1 replica. What must be true for the Service to distribute traffic roughly 90/10?

A.The Service must have 'sessionAffinity: ClientIP' to ensure sticky sessions
B.The Service must not have any selectors, and endpoints must be manually managed
C.The Service selector must include only 'version: v2'
D.The Service selector must include a label that both Deployments share, e.g., 'app: myapp'
AnswerD

The Service selector must include a label common to both Deployments—such as app: myapp—so that its endpoints automatically include pods from the stable and canary versions. Once the Service selects both sets of pods, Kubernetes round-robins requests across all available endpoints, and the proportion of traffic to each version roughly equals the ratio of ready pod counts (e.g., 9 v1 pods and 1 v2 pod for ~10% canary traffic). This shared-label selector is what enables a simple, replica-count-based canary without external traffic-weighting tools.

Why this answer

A Kubernetes Service distributes traffic across all Pods matching its label selector. For a canary deployment with 90/10 traffic split, both Deployments must share a common label (e.g., 'app: myapp') so the Service selects all 10 Pods (9 from v1, 1 from v2), achieving roughly 90% traffic to v1 and 10% to v2 based on replica count. The Service uses round-robin or random load balancing by default, so the ratio of replicas directly determines traffic distribution.

Exam trap

The trap here is that candidates often think a Service needs separate selectors for each version or that session affinity controls traffic splitting, when in fact the Service simply selects all matching Pods and traffic ratio follows replica count.

How to eliminate wrong answers

Option A is wrong because 'sessionAffinity: ClientIP' ensures sticky sessions (same client always goes to the same Pod), which would break the desired 90/10 distribution by pinning clients to specific versions, not by controlling traffic ratio. Option B is wrong because manually managing endpoints (no selectors) is unnecessary and defeats the purpose of using Deployments; the Service should automatically select Pods via labels. Option C is wrong because selecting only 'version: v2' would send 100% of traffic to the v2 Pod, not 10%.

126
MCQhard

An administrator runs 'kubectl apply -f deployment.yaml' and later wants to revert to the previous configuration. Which approach is correct?

A.Run 'kubectl edit deployment <name>' and manually revert changes.
B.Run 'kubectl rollout undo deployment <name>'.
C.Run 'kubectl delete -f deployment.yaml' and reapply the old YAML.
D.Run 'kubectl replace -f deployment.yaml' with the old YAML.
AnswerB

`kubectl rollout undo deployment <name>` is the canonical rollback command: it instructs the Deployment controller to scale down the current ReplicaSet and scale up the ReplicaSet from the previous revision, thereby restoring that prior pod template (image, env, labels, etc.). The controller then performs a normal rolling update to converge the Deployment to that older spec, and the revision history is updated accordingly. This is the safest automated method because it relies on the Deployment's revision tracking rather than on hand-crafting a manifest.

Why this answer

'kubectl rollout undo deployment <name>' reverts a Deployment to its previous ReplicaSet revision by rolling back the Deployment's pod template, which is the built-in mechanism Kubernetes provides for undoing a rollout. It uses the revision history stored in the Deployment's ReplicaSets, so it restores the prior configuration cleanly without manual editing.

Exam trap

CKAD often tests whether candidates know the native rollback command versus manual editing or delete/reapply; the trap is choosing a manual or destructive method instead of 'kubectl rollout undo'.

How to eliminate wrong answers

Option A is wrong because manually editing the Deployment does not leverage the stored revision history and is error-prone; it is not the correct rollback mechanism. Option C is wrong because deleting and reapplying the YAML causes downtime and does not use Kubernetes' native revision tracking, and it may not restore the exact prior state. Option D is wrong because 'kubectl replace' overwrites the object with the supplied YAML but does not perform a rollout or use revision history, so it is not the correct rollback approach.

127
MCQhard

You want to use Kustomize to apply a patch that adds a sidecar container to all pods in a Deployment. Which Kustomize feature should you use?

A.namePrefix
B.replicas
C.patchesStrategicMerge
D.images
AnswerC

`patchesStrategicMerge` is the designated Kustomize feature for overlaying partial YAML onto a base resource with Kubernetes-aware merge semantics. For a Deployment, a patch that adds a container with a new name under `spec.template.spec.containers` gets appended to the existing container list because that field uses `name` as its merge key. This lets you inject a sidecar without rewriting the whole manifest. It is specifically listed as the correct answer because it's the standard way to perform structural list modifications like adding containers.

Why this answer

`patchesStrategicMerge`, is correct because it allows you to apply a strategic merge patch to a Kubernetes resource, such as adding a sidecar container to all pods in a Deployment. This feature merges the patch into the base resource definition, enabling modifications like appending containers to the pod spec without overwriting the entire resource.

Exam trap

The trap here is that candidates often confuse `patchesStrategicMerge` with `images` or `replicas`, thinking those can modify pod templates, but only strategic merge patches can add new structural elements like containers to a resource.

How to eliminate wrong answers

Option A is wrong because `namePrefix` is used to add a prefix to the names of all resources in a Kustomize overlay, not to modify resource specifications like adding containers. Option B is wrong because `replicas` is a Kustomize field that sets the number of replicas for a Deployment, but it cannot add or modify containers within a pod. Option D is wrong because `images` is used to change the image tag or digest of existing containers in a resource, but it cannot add new containers like a sidecar.

128
Multi-Selectmedium

Which TWO of the following are true about Kustomize overlays? (Select 2)

Select 2 answers
A.Overlays can only add labels, not modify existing ones.
B.Overlays are used to customize resources for different environments.
C.Overlays must be stored in the same directory as the base.
D.Overlays can patch resources defined in a base.
E.Overlays can only be used with Helm charts.
AnswersB, D

Overlays layer environment-specific patches on top of a shared base, letting one set of manifests serve development, staging and production without duplication. This directly satisfies the stem's requirement that overlays customise resources per environment, since each overlay directory supplies only the differing values while inheriting the base.

Why this answer

Option B is correct because Kustomize overlays exist precisely to adapt a shared base for distinct environments such as dev, staging, and prod, applying environment-specific settings without duplicating the base manifests. Option D is correct because overlays use patches (strategic merge patches, JSON 6902 patches, or JSON merge patches) to modify resources declared in the base, and they can also add new resources. Option A is wrong because overlays can both add and modify labels, for example via the labels and commonLabels fields, so they are not limited to additions.

Option C is wrong because overlays are typically placed in separate directories that reference the base via a relative path in kustomization.yaml, not in the same directory. Option E is wrong because Kustomize works with plain Kubernetes YAML manifests and is not restricted to Helm charts.

129
MCQmedium

You are using the Recreate strategy for a Deployment. What happens during an update?

A.New pods are created before old ones are terminated
B.Pods are updated in-place with a rolling update
C.All existing pods are terminated before new pods are created
D.Some old pods remain running until new ones become ready
AnswerC

This is the defining behavior of the Recreate strategy: when a Deployment's pod template changes, the controller sets the old ReplicaSet's desired replicas to zero, waits for all existing pods to terminate, and only then scales up the new ReplicaSet. This guarantees zero overlap between old and new versions, at the cost of complete downtime during the rollout. It is correct because the rollout is strictly sequential, never concurrent.

Why this answer

The Recreate strategy terminates all existing pods before creating new ones. This is defined in the Deployment's `strategy.type: Recreate` field, which ensures that old Pods are deleted first, and only after they are fully terminated are new Pods created. This guarantees no overlapping versions run simultaneously, but it also causes downtime during the update.

Exam trap

The CKAD exam often tests the distinction between Recreate and RollingUpdate strategies, and the trap here is that candidates confuse the Recreate strategy's all-at-once termination with the RollingUpdate strategy's gradual replacement, especially when they see 'update' and assume zero-downtime behavior.

How to eliminate wrong answers

Option A is wrong because it describes the RollingUpdate strategy (specifically the `maxSurge` setting), where new pods are created before old ones are terminated to maintain availability. Option B is wrong because Kubernetes does not support in-place pod updates; pods are immutable and must be replaced by new pods with the updated specification. Option D is wrong because it describes the RollingUpdate strategy's behavior with `maxUnavailable: 0`, where some old pods remain until new ones become ready, which is the opposite of the Recreate strategy's all-at-once termination.

130
MCQeasy

You want to update a Deployment's image to a new version, ensuring that at most 2 pods are unavailable during the rollout. Which field in the Deployment spec should you set?

A.spec.replicas
B.spec.strategy.rollingUpdate.maxUnavailable
C.spec.strategy.rollingUpdate.maxSurge
D.spec.minReadySeconds
AnswerB

spec.strategy.rollingUpdate.maxUnavailable is correct because it sets the maximum number of pods that can be unavailable during a rolling update, relative to the desired replica count. It ensures a specified number of pods remain available to serve traffic while new pods come up. Tuning this value directly controls the trade-off between update speed and service availability, which is exactly what the question asks about.

Why this answer

The `maxUnavailable` field in the `spec.strategy.rollingUpdate` section controls the maximum number of Pods that can be unavailable during a rolling update. Setting `maxUnavailable: 2` ensures that at most 2 Pods are taken down at any time, maintaining the required availability threshold. This field is part of the Deployment's update strategy and directly governs the disruption budget during the rollout.

Exam trap

The trap here is confusing `maxUnavailable` with `maxSurge`, as both are rolling update parameters, but `maxSurge` controls extra Pods above the desired count, not the number of Pods that can be down.

How to eliminate wrong answers

Option A is wrong because `spec.replicas` defines the desired number of Pod replicas, not the availability constraints during an update. Option C is wrong because `spec.strategy.rollingUpdate.maxSurge` controls the maximum number of Pods that can be created above the desired replica count, not the number of unavailable Pods. Option D is wrong because `spec.minReadySeconds` defines the minimum time a Pod must be ready before it is considered available, which affects readiness checks but does not limit unavailability during a rollout.

131
MCQeasy

Which of the following is a valid method to perform a blue-green deployment in Kubernetes?

A.Create two Deployments and a Service, then change the Service's selector to point to the new version.
B.Use kubectl rollout undo to switch between revisions.
C.Set spec.strategy.type: BlueGreen in the Deployment.
D.Use a DaemonSet to run both versions.
AnswerA

This is the canonical blue-green deployment pattern in Kubernetes. You run two identical Deployment resources (one for the current 'blue' version, one for the new 'green' version) and a single Service that exposes them. By changing the Service's spec.selector to match the labels of the green Pods, you atomically shift production traffic from one version to the other, enabling zero-downtime releases and instant rollback by re-pointing the selector back to blue.

Why this answer

A blue-green deployment in Kubernetes is achieved by running two separate Deployments (blue and green) and using a Service to route traffic to the active version. By updating the Service's selector to match the labels of the new Deployment (green), traffic is instantly switched without downtime. This method does not rely on any built-in Deployment strategy, as Kubernetes does not have a native 'BlueGreen' strategy type.

Exam trap

The trap here is that candidates assume Kubernetes has a built-in 'BlueGreen' strategy type, but it does not; the correct approach is to manually manage two Deployments and update the Service selector.

How to eliminate wrong answers

Option B is wrong because 'kubectl rollout undo' is used to roll back to a previous revision of a Deployment, not to perform a blue-green switch between two simultaneously running versions. Option C is wrong because 'spec.strategy.type: BlueGreen' is not a valid Kubernetes Deployment strategy; the only built-in strategies are 'Recreate' and 'RollingUpdate'. Option D is wrong because a DaemonSet runs one pod per node and is designed for system daemons, not for managing two versions of an application in a blue-green deployment pattern.

132
MCQeasy

Which command is used to scale a Deployment named 'web' to 5 replicas?

A.kubectl scale deployment web --replicas=5
B.kubectl autoscale deployment web --min=5 --max=5
C.kubectl set replicas deployment/web 5
D.kubectl edit deployment web --replicas=5
AnswerA

The `kubectl scale` command is the correct, direct way to adjust the desired replica count for a Deployment. By setting `--replicas=5`, it updates the `spec.replicas` field in the Deployment's spec, causing the ReplicaSet controller to create or terminate Pods to reach exactly five replicas. This is an imperative, one-time change that does not register a separate autoscaling policy.

Why this answer

`kubectl scale deployment web --replicas=5` directly updates the `spec.replicas` field of the Deployment to 5, instructing the ReplicaSet controller to adjust the number of Pods to match the desired count. This is the standard imperative command for scaling workloads in Kubernetes.

Exam trap

The trap here is that candidates confuse `kubectl scale` with `kubectl autoscale` or assume `kubectl set replicas` exists, when in fact `kubectl scale` is the only direct imperative command for static replica changes, and `kubectl autoscale` is for dynamic, metric-based scaling only.

How to eliminate wrong answers

Option B is wrong because `kubectl autoscale` creates a HorizontalPodAutoscaler (HPA) that dynamically adjusts replicas based on metrics (e.g., CPU), not a static scale to exactly 5 replicas; setting `--min=5 --max=5` would create an HPA that keeps replicas at 5 but is an indirect, over-engineered approach for a simple static scale. Option C is wrong because `kubectl set replicas` is not a valid kubectl command; the correct syntax for setting a field imperatively is `kubectl set image` or `kubectl set resources`, but there is no `set replicas` subcommand. Option D is wrong because `kubectl edit deployment web --replicas=5` is invalid; `--replicas` is not a flag for `kubectl edit`, which opens an editor for manual YAML modification, and the replicas field must be changed within the editor, not via a command-line flag.

133
Multi-Selectmedium

Which THREE of the following are valid reasons to use an annotation in Kubernetes?

Select 3 answers
A.To enable a Service to select Pods based on the annotation value
B.To store the name of the CI/CD tool that deployed the resource
C.To record the build version or commit hash for auditing
D.To set resource limits for a container
E.To attach arbitrary non-identifying metadata to an object
AnswersB, C, E

Annotations hold non-identifying metadata that Kubernetes never uses for scheduling or selection. Recording the deploying CI/CD tool's name is purely informational, so it fits an annotation rather than a label, which must remain queryable and short.

Why this answer

Option B is correct because annotations are designed to hold non-identifying metadata such as tooling information, so recording the CI/CD tool that deployed a resource is a valid use. Option C is correct because annotations commonly store build versions or commit hashes for auditing and traceability, since this metadata does not need to be used for selection or scheduling. Option E is correct because the Kubernetes API explicitly defines annotations as a way to attach arbitrary non-identifying metadata to objects, which is their core purpose.

Option A is not valid because Service Pod selection is performed with label selectors, not annotations, which cannot be used in selectors. Option D is not valid because container resource limits are set in the pod spec under resources.limits, not via annotations.

134
MCQeasy

In a Deployment YAML, which field defines the number of pods to run?

A.spec.strategy.replicas
B.spec.template.replicas
C.spec.replicas
D.metadata.replicas
AnswerC

spec.replicas is the correct field because it lives directly under the Deployment's top-level spec and defines the desired number of running pod replicas. The Deployment controller ensures the current number of pods matches this value by creating or deleting ReplicaSets, and it is optional; if omitted, it defaults to 1.

Why this answer

In a Kubernetes Deployment YAML, the `spec.replicas` field directly specifies the desired number of Pod replicas that the Deployment controller should maintain. This field is part of the Deployment's specification and tells the controller to create or scale Pods to match the given count.

Exam trap

The CKAD exam often tests the confusion between `spec.replicas` (the correct field) and `spec.template.replicas` (which does not exist), leading candidates to incorrectly assume replicas are defined inside the Pod template.

How to eliminate wrong answers

Option A is wrong because `spec.strategy.replicas` does not exist; the `strategy` field defines the update strategy (e.g., RollingUpdate or Recreate), not the replica count. Option B is wrong because `spec.template.replicas` is invalid; the `template` field describes the Pod template, and replicas are not defined within it. Option D is wrong because `metadata.replicas` is not a valid field; `metadata` contains labels, annotations, and identifiers, not replica counts.

135
MCQmedium

You have a Deployment that uses the 'Recreate' strategy. What happens when you update the pod template (e.g., change the image)?

A.The update is not allowed; you must delete the Deployment first
B.All existing pods are terminated before new pods are created
C.New pods are created gradually while old pods are terminated
D.Pods are updated in-place without restart
AnswerB

In the Recreate strategy, the Deployment controller first terminates all existing pods by scaling the old ReplicaSet down to 0, and only after all old pods have been deleted does it create new pods by scaling up the new ReplicaSet. This guarantees there is never a period where old and new versions run concurrently, but it also means the application experiences full downtime during the switch. The sequence is deliberate: scale down must complete before scale up starts.

Why this answer

The 'Recreate' strategy in a Kubernetes Deployment terminates all existing pods before creating new ones when the pod template is updated. This ensures zero overlapping pods during the update, which is useful for applications that cannot handle multiple versions running simultaneously.

Exam trap

The trap here is that candidates often confuse the 'Recreate' strategy with the default 'RollingUpdate' strategy, mistakenly thinking new pods are created gradually or that in-place updates are possible, when in fact 'Recreate' ensures all old pods are terminated first.

How to eliminate wrong answers

Option A is wrong because updating the pod template in a Deployment is allowed and does not require deleting the Deployment first; the Deployment controller handles the update based on its strategy. Option C is wrong because it describes the 'RollingUpdate' strategy, where new pods are created gradually while old pods are terminated, not the 'Recreate' strategy. Option D is wrong because Kubernetes does not support in-place updates of pods; pods are immutable and must be replaced to apply changes to the pod template.

136
MCQeasy

You have a Helm release named 'myapp' that was installed. You need to see all the releases in the current namespace. Which command do you run?

A.helm list
B.helm repo list
C.helm status myapp
D.helm get all myapp
AnswerA

helm list queries the configured Helm storage backend (typically Secrets in the target namespace) and returns every installed release in the current namespace by default, displaying the release name, chart, app version, revision, and status. It is the standard command to enumerate releases; adding the -A or --all-namespaces flag widens the search across all namespaces.

Why this answer

helm list lists all releases in the current namespace. Option A is correct because it displays a list of all Helm releases. Option B, helm repo list, lists repositories, not releases.

Option C, helm status myapp, shows status of a single release. Option D, helm get all myapp, retrieves information about a specific release.

137
MCQeasy

You want to deploy an application with zero downtime by using a blue-green deployment pattern. Which Kubernetes resources are essential for implementing this strategy?

A.A single Deployment with a RollingUpdate strategy
B.A StatefulSet and a Headless Service
C.A Deployment with a Recreate strategy and an Ingress
D.Two Deployments (blue and green) and a Service that can switch its selector
AnswerD

Blue-green deployment is implemented by two separate Deployments, one labelled as blue (current) and one as green (new), with a single Service whose selector is initially set to match the blue pods' labels. After the green Deployment is fully rolled out and verified, you update the Service's selector to point at the green pods, which instantly changes the traffic destination for all clients without any downtime. This gives you a fast, atomic switchover and an equally fast rollback by reverting the selector, because both versions remain running throughout the process.

Why this answer

Blue-green deployments in Kubernetes require two separate Deployments (blue and green) to maintain separate environments, and a Service that can switch its selector labels to route traffic to the active deployment. Option D is correct because it describes exactly this pattern. Option A uses a single Deployment with RollingUpdate, which is a different strategy for zero downtime but not blue-green.

Option B uses StatefulSet and Headless Service, which are for stateful applications and do not support blue-green switching. Option C uses a Recreate strategy, which causes downtime by terminating all pods before creating new ones, and Ingress alone cannot switch between two deployments without additional configuration.

138
Multi-Selecthard

Which THREE of the following are correct about Kustomize?

Select 3 answers
A.A 'kustomization.yaml' file is required in each Kustomize directory.
B.A 'patches' field in kustomization.yaml can be used to override fields in resources.
C.The command 'kustomize apply' deploys resources to the cluster.
D.Kustomize uses Helm-style templates to generate resources.
E.A base can be a local directory or a remote URL.
AnswersA, B, E

A kustomization.yaml file is the mandatory entrypoint for every Kustomize directory; without it, kustomize build fails because Kustomize has no manifest of resources, transformers, or patches to process. This file declares the resources list and any customization directives, and it must be named exactly kustomization.yaml (or kustomization.yml) for the directory to be recognized as a valid Kustomize target.

Why this answer

Options A, B, and E are correct. Option A: A kustomization.yaml file is required in each Kustomize directory to define resources, bases, and patches. Option B: The 'patches' field in kustomization.yaml allows overriding fields in resources via strategic merge patches or JSON patches.

Option E: A base can be a local directory referenced via path or a remote URL (e.g., git repository). Option C is incorrect because 'kustomize build' outputs the rendered YAML to stdout; there is no 'kustomize apply' command. Option D is incorrect because Kustomize does not use templates; it uses overlays and patching without templating.

139
MCQmedium

You run 'kubectl apply -f deployment.yaml' and later 'kubectl replace -f deployment.yaml' on the same file. What is the difference?

A.apply merges changes, replace replaces the entire resource
B.apply is used for Deployments only, replace for any resource
C.apply requires --record flag, replace does not
D.apply creates, replace updates
AnswerA

kubectl apply is declarative: it stores a `last-applied-configuration` annotation, computes a patch against the live object, and performs a three-way merge so changes made by other controllers are preserved, while fields you explicitly removed are deleted. kubectl replace reads the entire YAML/JSON you supply and submits it as the new full object definition, overwriting the live resource outright without merging or reconciling differences with the current state.

Why this answer

'kubectl apply' performs a declarative three-way merge between the last-applied-configuration annotation, the live object, and the new file, so it only changes fields that differ. 'kubectl replace' performs a full replacement of the resource with the contents of the file, overwriting the entire object and failing if the resource does not exist.

Exam trap

CKAD often tests the misconception that apply and replace differ only in create-vs-update semantics, when the real distinction is declarative three-way merge versus full object replacement.

How to eliminate wrong answers

Option B is wrong because both apply and replace work on any Kubernetes resource type, not just Deployments. Option C is wrong because '--record' is an optional flag for recording the command in the resource's annotation and is not required by either apply or replace. Option D is wrong because apply can both create and update resources, and replace only updates (it fails if the resource does not exist) — the distinction is merge vs. full replacement, not create vs. update.

140
MCQmedium

You have created a HorizontalPodAutoscaler (HPA) for a Deployment. The HPA is configured with targetCPUUtilizationPercentage: 50. The current CPU utilization is 80%. What will the HPA do?

A.It will restart the pods
B.It will do nothing because HPA only scales based on memory
C.It will increase the number of replicas
D.It will decrease the number of replicas
AnswerC

When the average CPU utilization across the current pods is above the target value, the HPA controller calculates a desired replica count using the formula `ceil(currentReplicas * (currentMetric / desiredMetric))`. Since the ratio is greater than 1, it produces a response that increases `spec.replicas` on the target workload. This is the exact behavior expected: scale-out to reduce the per-pod CPU load to the configured target. The controller will gradually raise the replica count, subject to the `maxReplicas` limit.

Why this answer

The HPA will increase the number of replicas to bring average CPU utilization down to the target.

141
MCQhard

A Deployment has a rolling update strategy with maxSurge: 1 and maxUnavailable: 0. The Deployment has 4 replicas. During a rollout, what is the maximum number of pods that can exist at any point?

A.5
B.6
C.8
D.4
AnswerA

With maxSurge set to 1, Kubernetes is allowed to create one extra pod above the desired replica count during a rolling update. Since the deployment's desired count is 4, the absolute maximum number of pods that can exist at any moment is 4 + 1 = 5. This surge pod ensures the new ReplicaSet can scale up before any old pods are terminated, maintaining availability throughout the update.

Why this answer

With maxSurge: 1 and maxUnavailable: 0, the Deployment controller ensures that during a rolling update, at most one additional pod (beyond the desired 4 replicas) is created before terminating old pods. Since no pods can be unavailable, the maximum number of pods at any point is 4 (desired) + 1 (surge) = 5.

Exam trap

Kubernetes often tests the interaction between maxSurge and maxUnavailable, where candidates mistakenly add the surge to the maximum unavailable value or forget that maxUnavailable: 0 forces the surge to be created before any termination.

How to eliminate wrong answers

Option B (6) is wrong because it assumes maxSurge could be 2 or that the surge count is doubled, but maxSurge is explicitly set to 1. Option C (8) is wrong because it incorrectly doubles both the desired replicas and the surge, possibly confusing maxSurge with a percentage-based calculation. Option D (4) is wrong because it ignores the maxSurge parameter entirely, assuming no extra pods are created during the rollout.

142
MCQmedium

You want to perform a blue-green deployment using Deployments and Services. You have two Deployments: 'app-blue' (current) and 'app-green' (new). The Service 'app-service' currently selects pods with label 'version: blue'. What kubectl command should you run to switch traffic to the green deployment?

A.kubectl patch service app-service -p '{"spec":{"selector":{"version":"green"}}}'
B.kubectl delete service app-service --ignore-not-found && kubectl create service app-service --selector version=green
C.kubectl set selector service/app-service version=green
D.kubectl apply -f service.yaml where service.yaml has the new selector
AnswerA

The patch command mutates the existing Service's selector in place, updating the label selector from version=blue to version=green. Because the Service object is not deleted, its ClusterIP and NodePort are preserved, and Kubernetes immediately reconciles the Endpoints to include the green pods and exclude blue pods. This is the canonical zero-downtime traffic shift in a blue-green deployment, as it requires no file creation and only a single atomic API call.

Why this answer

A Kubernetes Service routes traffic based on its label selector, so blue-green switching is achieved by changing the Service's selector to point at the new pods. The kubectl patch command with a strategic merge patch on spec.selector updates the selector in place, instantly redirecting traffic to pods labeled version: green without recreating the Service or changing its ClusterIP. This is the canonical, non-disruptive way to flip traffic between blue and green Deployments.

Exam trap

CKAD often tests whether candidates know that Service selectors are mutable via patch and that delete/recreate breaks the ClusterIP, so the trap is choosing the destructive recreate option or an invalid subcommand like 'set selector'.

How to eliminate wrong answers

Option B is wrong because deleting and recreating the Service changes its ClusterIP and causes downtime, breaking DNS records and any clients caching the old IP — the opposite of a zero-downtime blue-green cutover. Option C is wrong because 'kubectl set selector' is not a valid kubectl subcommand; selector changes must go through patch, edit, or apply. Option D is wrong because it is not a specific command — while applying a manifest with a new selector can work, the question asks for the command to run, and a bare apply without the correct file content is not a deterministic answer; patch is the precise, direct method.

143
Multi-Selecthard

You need to perform a canary deployment using a Service and two Deployments (stable and canary). Which TWO resources or configurations are typically used to route a percentage of traffic to the canary? (Select TWO)

Select 2 answers
A.Service Mesh (e.g., Istio VirtualService)
B.A single Service with multiple label selectors
C.NetworkPolicy
D.Ingress with canary annotation
E.HorizontalPodAutoscaler
AnswersA, D

A service mesh such as Istio provides VirtualService and DestinationRule resources that split traffic between the stable and canary Deployments by weighted percentages, giving fine-grained, L7 control that a plain Kubernetes Service cannot achieve on its own.

Why this answer

Option A (Service Mesh, e.g., Istio VirtualService) is correct because a service mesh like Istio can split traffic between the stable and canary Deployments at the L7 level, using VirtualService/DestinationRule weights to send a precise percentage of requests to the canary subset. Option D (Ingress with canary annotation) is correct because ingress controllers such as NGINX Ingress support canary annotations (e.g., nginx.ingress.kubernetes.io/canary and canary-weight) to route a defined percentage of traffic to a canary backend Service. Option B is not valid because a Kubernetes Service has a single label selector and cannot natively split traffic by percentage across two Deployments.

Option C is incorrect because NetworkPolicy only controls L3/L4 pod-level ingress/egress firewall rules, not HTTP traffic weighting. Option E is incorrect because a HorizontalPodAutoscaler only scales replica counts based on metrics and does not perform traffic routing or canary splitting.

Exam trap

A common misconception in CKAD is that a single Service with multiple selectors can split traffic by percentage, when in fact Kubernetes Services only support label-based selection and round-robin load balancing without weighted routing.

144
MCQhard

You have a Helm chart for an application. After running 'helm install my-release ./mychart', you realize you forgot to set a required value. Which command can you use to update the release with the correct value while keeping the same chart version?

A.kubectl edit deployment my-release
B.helm install my-release ./mychart --set key=value
C.helm upgrade my-release ./mychart --set key=value
D.helm rollback my-release 1
AnswerC

helm upgrade my-release ./mychart --set key=value is the correct Helm-native way to apply new chart values to an existing release. The upgrade command compares the current release's manifests (from the last rendered chart) with the desired state rendered from ./mychart combined with the new --set key=value override, then computes and applies a Kubernetes patch to update only changed resources. It increments the release revision, updates the Helm release metadata, and preserves prior revisions so the change can be rolled back if needed.

Why this answer

Helm upgrade modifies a release with new values or chart changes. The --set flag overrides values inline.

145
MCQmedium

A Deployment named 'app' has the following strategy: type: RollingUpdate with maxSurge=1 and maxUnavailable=0. You have 5 replicas. During a rolling update, how many pods will be running at any given time?

A.Between 5 and 6
B.Between 4 and 5
C.Between 5 and 10
D.Exactly 5
AnswerA

With maxUnavailable=0, the Deployment controller guarantees that the desired 5 pods remain available throughout the update, so the available count never falls below 5. At the same time, maxSurge=1 allows at most one additional pod to be created above the desired count, capping the total at 6 (5 old + 1 new, or 5 new + 1 old). Therefore the running pod count stays between 5 and 6 for the duration of the rolling update.

Why this answer

With maxSurge=1 and maxUnavailable=0 on a 5-replica Deployment, Kubernetes must keep all 5 original pods available at all times while it may temporarily add 1 extra pod above the desired count. Therefore the total number of running pods ranges from 5 (when no surge pod exists yet) up to 6 (when one surge pod is created before an old one is terminated). The rollout proceeds by creating one new pod, waiting for it to become Ready, then terminating one old pod, keeping the count between 5 and 6.

Exam trap

CKAD often tests the confusion between maxSurge and maxUnavailable — candidates incorrectly assume maxUnavailable=0 means no extra pods can be created, or that maxSurge adds to the total rather than defining a temporary ceiling.

How to eliminate wrong answers

Option B is wrong because maxUnavailable=0 explicitly forbids dropping below the desired replica count, so the minimum is 5, not 4. Option C is wrong because maxSurge=1 limits the surge to a single extra pod, so the maximum is 6, not 10 (10 would require maxSurge=5 or 100%). Option D is wrong because maxSurge=1 permits a temporary extra pod, so the count is not fixed at exactly 5 — it fluctuates between 5 and 6 during the rollout.

146
MCQhard

You are using Helm to manage an application. After running 'helm install myapp ./mychart', you notice that the application is running but you need to change a configuration value. Which command should you use to update the release?

A.helm update myapp ./mychart
B.helm install myapp ./mychart --replace
C.kubectl edit deployment myapp
D.helm upgrade myapp ./mychart --set key=value
AnswerD

`helm upgrade myapp ./mychart --set key=value` is the correct command because it tells Helm to update the existing release `myapp` using the chart at `./mychart`, while `--set` overrides the chart's default value for `key`. Helm increments the release revision, applies a calculated patch to the cluster resources, and records the new values in its history so the change can be rolled back if needed. This is the standard Helm workflow for updating an application after the initial `helm install`.

Why this answer

'helm upgrade' is the correct command to update an existing release with new chart values or a new chart version. Passing '--set key=value' overrides a specific value at upgrade time, and Helm computes a diff against the previous release, applying only the necessary Kubernetes changes. 'helm install' is only for creating new releases.

Exam trap

CKAD often tests whether candidates know the correct Helm verb ('upgrade', not 'update') and whether they understand that editing resources directly with kubectl breaks Helm's release tracking — the trap is choosing the kubectl shortcut for a Helm-managed release.

How to eliminate wrong answers

Option A is wrong because 'helm update' is not a valid Helm subcommand — the correct verb is 'upgrade'. Option B is wrong because 'helm install --replace' is a legacy/edge-case flag that reuses a release name after deletion; it is not the standard way to modify a running release and can cause downtime. Option C is wrong because 'kubectl edit deployment' bypasses Helm entirely, causing the live state to drift from the Helm release state; the next 'helm upgrade' would overwrite the manual edit, and 'helm rollback' would not capture it.

147
MCQeasy

You need to scale a Deployment named 'api' to 10 replicas instantly. Which command should you use?

A.kubectl autoscale deployment api --min=10 --max=10
B.kubectl patch deployment api -p '{"spec":{"replicas":10}}'
C.kubectl resize deployment api --replicas=10
D.kubectl scale deployment api --replicas=10
AnswerD

The `kubectl scale deployment api --replicas=10` command is the standard, imperative way to directly change the replica count of a Deployment. It updates the Deployment's desired state to 10 replicas, causing the ReplicaSet controller to create or remove Pods until the actual count matches the desired count. This command is explicit, concise, and explicitly designed for scaling resources, making it the correct answer.

Why this answer

`kubectl scale` is the dedicated imperative command to change the replica count of a Deployment instantly. It directly updates the `spec.replicas` field in the Deployment's desired state, causing the controller to immediately create or terminate Pods to match the new count.

Exam trap

The trap here is that candidates may confuse `kubectl autoscale` (which creates an HPA for dynamic scaling) with `kubectl scale` (which performs an immediate, static replica change), or they may invent a non-existent command like `kubectl resize`.

How to eliminate wrong answers

Option A is wrong because `kubectl autoscale` creates a HorizontalPodAutoscaler (HPA) that adjusts replicas dynamically based on metrics, not an instant static change; setting `--min=10 --max=10` would still create an HPA object, not directly scale the Deployment. Option B is wrong because while `kubectl patch` can technically update the replicas field, it is a generic, less idiomatic approach for scaling; the CKAD exam expects the purpose-built `kubectl scale` command for this task. Option C is wrong because `kubectl resize` is not a valid kubectl command; no such subcommand exists in the Kubernetes CLI.

148
MCQmedium

Which field in a Deployment's rolling update strategy controls the maximum number of pods that can be created above the desired replicas during a rolling update?

A.maxUnavailable
B.maxSurge
C.revisionHistoryLimit
D.minReadySeconds
AnswerB

It is the correct field because it defines how many extra pods can be created over the desired replica count during a rolling update, enabling faster rollout by ensuring new pods become ready before old ones are terminated. The default value is 25% of the desired pods, and the total number of pods can temporarily exceed the desired count by this amount.

Why this answer

In a Deployment's rolling update strategy, `maxSurge` controls the maximum number of pods that can be created above the desired replica count during the update. This allows the system to spin up new pods before terminating old ones, ensuring zero downtime. The value can be an absolute number or a percentage of the desired replicas.

Exam trap

The trap here is confusing `maxSurge` with `maxUnavailable`, as both are percentage-based fields in the rolling update strategy, but `maxSurge` controls the extra pods above the desired count while `maxUnavailable` controls the deficit below it.

How to eliminate wrong answers

Option A is wrong because `maxUnavailable` controls the maximum number of pods that can be unavailable during the update, not the number created above the desired count. Option C is wrong because `revisionHistoryLimit` specifies how many old ReplicaSets to retain for rollback, not the surge capacity. Option D is wrong because `minReadySeconds` defines how long a pod must be ready before it is considered available, which affects the rollout speed but not the maximum number of pods above the desired replicas.

149
MCQeasy

What is the purpose of a HorizontalPodAutoscaler (HPA)?

A.To update the application version without downtime
B.To restart pods automatically when they fail
C.To distribute incoming traffic across multiple pods
D.To automatically adjust the number of pods based on resource metrics
AnswerD

The HPA controller watches metrics such as CPU utilisation and adjusts a workload's replica count to meet a target, scaling pods horizontally. It satisfies the requirement to match capacity to demand automatically rather than manually resizing deployments.

Why this answer

A HorizontalPodAutoscaler automatically scales the number of pods in a Deployment, ReplicaSet, or StatefulSet based on observed CPU utilization (or other custom metrics).

150
MCQmedium

When performing a rolling update of a Deployment, which field in the Deployment spec controls the maximum number of Pods that can be created above the desired replicas during the update?

A.spec.strategy.type
B.spec.strategy.rollingUpdate.maxSurge
C.spec.strategy.rollingUpdate.maxUnavailable
D.spec.replicas
AnswerB

`spec.strategy.rollingUpdate.maxSurge` is the correct field because it explicitly caps how many Pods can be temporarily created above the desired replica count during a rolling update. It can be configured as an absolute number or as a percentage of `spec.replicas`, giving the controller permission to overshoot the target while replacing old Pods. This overshoot allows new Pods to become ready before old ones are terminated, reducing downtime. Without this field, the default value is 25%, meaning Kubernetes will not create more than 25% extra Pods beyond the replica target.

Why this answer

maxSurge defines how many Pods can be created above the desired replica count during a rolling update.

← PreviousPage 2 of 3 · 163 questions totalNext →

Ready to test yourself?

Try a timed practice session using only Ckad Deployment questions.