CKAD · Domain 2 of 5 · 20% of the exam

CKAD Domain 2: Application Deployment

40 free practice questions for Application Deployment in the Certified Kubernetes Application Developer (CKAD) exam. Try each question first, then open "Show answer" for the correct option and explanation.

Application Deployment practice questions

  1. Question 1. How is a blue/green release usually done with plain Kubernetes objects?

    1. Set the Deployment strategy type to BlueGreen
    2. Run both Deployments and switch the Service selector to green
    3. Scale blue to zero, then edit its image to green
    4. Create a second Service with the same ClusterIP
    Show answer

    Answer: B. Run both Deployments and switch the Service selector to green

    Deployments have no BlueGreen strategy. You run the new version next to the old one, then change the Service selector (for example version: green) to move all traffic at once.

  2. Question 2. Deployment shop-v1 has 9 replicas and shop-v2 has 1. Both have the label app=shop, which one Service selects. What is this?

    1. A blue/green switch with an instant cutover
    2. A rolling update managed by one ReplicaSet
    3. A canary, with about 10% of requests reaching v2
    4. A misconfiguration; a Service uses one Deployment
    Show answer

    Answer: C. A canary, with about 10% of requests reaching v2

    A Service balances across all Ready Pods that match its selector, so the replica ratio sets the rough traffic split.

  3. Question 3. What is the main advantage of a blue/green release over a rolling update?

    1. It needs half as many cluster resources
    2. Rollback is instant, by switching traffic back
    3. No Service is needed in front of the Pods
    4. The old version is deleted before the switch
    Show answer

    Answer: B. Rollback is instant, by switching traffic back

    The old version keeps running until you're confident, so rolling back is one selector change. The cost is running both versions at full size.

  4. Question 4. Which Gateway API feature splits traffic 90/10 between two Services for a canary?

    1. maxSurge on the Gateway resource
    2. sessionAffinity on the GatewayClass
    3. weight values on backendRefs in an HTTPRoute
    4. replicas on each ReferenceGrant
    Show answer

    Answer: C. weight values on backendRefs in an HTTPRoute

    An HTTPRoute rule can list several backendRefs with weights, for example 90 and 10, independent of replica counts.

  5. Question 5. Which command scales Deployment api to 5 replicas?

    1. kubectl set replicas deployment/api 5
    2. kubectl rollout scale api --to=5
    3. kubectl scale deployment api --replicas=5
    4. kubectl autoscale deployment api --count=5
    Show answer

    Answer: C. kubectl scale deployment api --replicas=5

    kubectl scale changes spec.replicas. kubectl autoscale creates a HorizontalPodAutoscaler instead.

  6. Question 6. Which command pauses a Deployment's rollout so several changes can be applied as one?

    1. kubectl rollout pause deployment/web
    2. kubectl rollout hold deployment/web
    3. kubectl scale deployment web --replicas=0
    4. kubectl annotate deployment web paused=true
    Show answer

    Answer: A. kubectl rollout pause deployment/web

    While paused, changes to the Pod template don't trigger a rollout. kubectl rollout resume starts one rollout with all the changes.

  7. Question 7. Which command restarts all Pods of a Deployment, through a rolling update, without changing its spec by hand?

    1. kubectl rollout undo deployment/web
    2. kubectl rollout resume deployment/web
    3. kubectl delete deployment web --cascade
    4. kubectl rollout restart deployment/web
    Show answer

    Answer: D. kubectl rollout restart deployment/web

    rollout restart adds a restartedAt annotation to the Pod template, which triggers a normal rolling update. It's handy after a ConfigMap change.

  8. Question 8. Which command rolls Deployment web back to revision 2 specifically?

    1. kubectl rollout history deployment/web --revision=2
    2. kubectl rollout undo deployment/web --to-revision=2
    3. kubectl rollout restart deployment/web --revision=2
    4. kubectl set revision deployment/web 2
    Show answer

    Answer: B. kubectl rollout undo deployment/web --to-revision=2

    Without --to-revision, undo goes to the previous revision. history --revision=2 only shows the details of that revision.

  9. Question 9. How can you record a reason for a change that shows in the CHANGE-CAUSE column of kubectl rollout history?

    1. Add a reason field to the Pod template
    2. Label the ReplicaSet with change-reason
    3. Set the kubernetes.io/change-cause annotation
    4. Write the reason into the Deployment's status
    Show answer

    Answer: C. Set the kubernetes.io/change-cause annotation

    kubectl annotate deployment/web kubernetes.io/change-cause="..." is copied to the new revision. The old --record flag is deprecated.

  10. Question 10. How many old ReplicaSets does a Deployment keep for rollbacks by default?

    1. 1
    2. 3
    3. 10
    4. Unlimited
    Show answer

    Answer: C. 10

    revisionHistoryLimit defaults to 10. Old ReplicaSets are scaled to zero but kept so you can roll back to them.

  11. Question 11. A Deployment's rollout makes no progress for 10 minutes. What does the controller do by default?

    1. Marks it Progressing=False with ProgressDeadlineExceeded
    2. Rolls back to the previous revision automatically
    3. Deletes the new ReplicaSet and its Pods
    4. Restarts the rollout from the first Pod
    Show answer

    Answer: A. Marks it Progressing=False with ProgressDeadlineExceeded

    progressDeadlineSeconds defaults to 600. Kubernetes reports the failure but doesn't roll back on its own; kubectl rollout status exits non-zero.

  12. Question 12. What does minReadySeconds do in a Deployment?

    1. Delays scheduling of each new Pod by that many seconds
    2. Sets how long old Pods get to shut down
    3. Sets the readiness probe's initial delay
    4. A new Pod must stay Ready that long to count as available
    Show answer

    Answer: D. A new Pod must stay Ready that long to count as available

    It guards against Pods that pass readiness and then crash soon after, slowing the rollout down until each Pod proves stable.

  13. Question 13. A Deployment has 4 replicas, maxSurge: 25%, and maxUnavailable: 25%. What is the most Pods that can exist during a rollout?

    1. 4
    2. 5
    3. 6
    4. 8
    Show answer

    Answer: B. 5

    25% of 4 is 1, so at most 4 + 1 = 5 Pods exist and at least 4 - 1 = 3 are available.

  14. Question 14. Which change to a Deployment triggers a new rollout?

    1. Changing spec.replicas
    2. Adding a label to the Deployment's metadata
    3. Changing the container image in the Pod template
    4. Changing revisionHistoryLimit
    Show answer

    Answer: C. Changing the container image in the Pod template

    Only changes to spec.template create a new ReplicaSet and revision. Scaling and other fields are applied in place.

  15. Question 15. Which DaemonSet update strategy replaces Pods only when you delete them yourself?

    1. RollingUpdate
    2. Recreate
    3. OnDelete
    4. Manual
    Show answer

    Answer: C. OnDelete

    With OnDelete, the template change takes effect only for Pods created after you delete the old ones. RollingUpdate is the default.

  16. Question 16. What is a Helm chart?

    1. A running instance of an application
    2. A diagram of a cluster's resources
    3. A registry that stores container images
    4. A package of templated Kubernetes manifests
    Show answer

    Answer: D. A package of templated Kubernetes manifests

    A chart holds Chart.yaml, default values.yaml, and templates. Installing it renders the templates into manifests.

  17. Question 17. In Helm, what is a release?

    1. An installed instance of a chart in a cluster
    2. A published version of the Helm client
    3. A tagged image in a chart repository
    4. A namespace created only for a chart
    Show answer

    Answer: A. An installed instance of a chart in a cluster

    Each helm install creates a named release. Upgrades and rollbacks create new revisions of that release.

  18. Question 18. Which command adds the chart repository https://charts.example.com under the name example?

    1. helm install example https://charts.example.com
    2. helm repo add example https://charts.example.com
    3. helm pull example https://charts.example.com
    4. helm registry new example https://charts.example.com
    Show answer

    Answer: B. helm repo add example https://charts.example.com

    After adding it, run helm repo update to refresh the local index, and install with example/<chart>.

  19. Question 19. Which command searches added repositories for charts matching redis?

    1. helm find redis
    2. helm list redis
    3. helm search repo redis
    4. helm repo get redis
    Show answer

    Answer: C. helm search repo redis

    helm search repo searches the indexes of added repositories. helm search hub searches Artifact Hub.

  20. Question 20. Which command upgrades release web, or installs it if it doesn't exist yet?

    1. helm install --upgrade web example/web
    2. helm apply web example/web
    3. helm rollout web example/web
    4. helm upgrade --install web example/web
    Show answer

    Answer: D. helm upgrade --install web example/web

    helm upgrade --install (-i) is idempotent, which makes it common in CI pipelines.

  21. Question 21. Which command shows the default values a chart accepts, before you install it?

    1. helm show values example/web
    2. helm get values example/web
    3. helm status example/web
    4. helm lint example/web
    Show answer

    Answer: A. helm show values example/web

    helm show values reads the chart's values.yaml. helm get values reads the values supplied to an installed release.

  22. Question 22. Which command shows the values that were supplied when release web was installed or upgraded?

    1. helm show values web
    2. helm get values web
    3. helm history web
    4. helm search values web
    Show answer

    Answer: B. helm get values web

    helm get values shows user-supplied values; add --all to include the chart defaults.

  23. Question 23. Which command rolls release web back to revision 3?

    1. helm undo web --revision 3
    2. helm upgrade web --revision 3
    3. helm rollback web 3
    4. kubectl rollout undo release/web --to-revision=3
    Show answer

    Answer: C. helm rollback web 3

    helm history web lists revisions. A rollback creates a new revision with the old configuration.

  24. Question 24. Which command renders a chart's templates locally, without installing anything?

    1. helm render example/web
    2. helm show chart example/web
    3. helm get manifest web
    4. helm template web example/web
    Show answer

    Answer: D. helm template web example/web

    helm template prints the rendered manifests. helm get manifest shows what an installed release deployed.

  25. Question 25. Which command lists Helm releases in every namespace?

    1. helm list -A
    2. helm ls --charts
    3. helm repo list -A
    4. helm status --all
    Show answer

    Answer: A. helm list -A

    helm list shows releases in the current namespace; -A (--all-namespaces) includes all of them.

  26. Question 26. values.yaml sets replicaCount: 2. You run helm install web example/web -f values.yaml --set replicaCount=4. Which value is used?

    1. 2, because files override --set
    2. 4, because --set overrides values files
    3. The chart's own default value
    4. None; the install fails on the conflict
    Show answer

    Answer: B. 4, because --set overrides values files

    Precedence, lowest to highest: chart defaults, -f files in order, then --set values.

  27. Question 27. Which command installs a chart into namespace shop, creating the namespace if it doesn't exist?

    1. helm install web example/web --ns shop --init
    2. helm install web example/web -n shop --force
    3. helm install web example/web -n shop --create-namespace
    4. helm install web example/web --namespace=new:shop
    Show answer

    Answer: C. helm install web example/web -n shop --create-namespace

    -n sets the release namespace and --create-namespace creates it first.

  28. Question 28. Which command installs version 1.4.2 of a chart rather than the latest one?

    1. helm install web example/web --tag 1.4.2
    2. helm install web example/web --version 1.4.2
    3. helm install web example/web --revision 1.4.2
    4. helm install web example/web --chart=1.4.2
    Show answer

    Answer: B. helm install web example/web --version 1.4.2

    --version selects the chart version (from Chart.yaml's version field), not the app version.

  29. Question 29. Which file must a directory contain for kubectl apply -k to work on it?

    1. Chart.yaml
    2. values.yaml
    3. kustomization.yaml
    4. Kustomizefile
    Show answer

    Answer: C. kustomization.yaml

    kubectl apply -k <dir> runs Kustomize on the kustomization.yaml in that directory and applies the result.

  30. Question 30. Which command prints the manifests a Kustomize directory produces, without applying them?

    1. kubectl kustomize ./overlays/prod
    2. kubectl get -k ./overlays/prod
    3. kubectl diff --render ./overlays/prod
    4. kubectl apply -k ./overlays/prod --print
    Show answer

    Answer: A. kubectl kustomize ./overlays/prod

    kubectl kustomize renders to stdout. Compare with the cluster using kubectl diff -k.

  31. Question 31. In Kustomize, how does a prod overlay reuse the base manifests?

    1. It copies the base files into its own folder
    2. It imports the base through a values file
    3. It sets base: true in each manifest
    4. It lists the base directory under resources
    Show answer

    Answer: D. It lists the base directory under resources

    The overlay's kustomization.yaml lists ../../base under resources, then adds patches, a namespace, labels, or image changes.

  32. Question 32. Which kustomization.yaml field changes a container image's tag without editing the Deployment file?

    1. replicas
    2. namePrefix
    3. images, with newTag
    4. configMapGenerator
    Show answer

    Answer: C. images, with newTag

    The images transformer matches by image name and can set newName, newTag, or digest.

  33. Question 33. What does namePrefix: dev- do in a kustomization.yaml?

    1. Creates the resources in namespace dev
    2. Prepends dev- to the names of all resources
    3. Adds the label env=dev to every resource
    4. Applies only files whose names start with dev-
    Show answer

    Answer: B. Prepends dev- to the names of all resources

    Kustomize also updates references, such as a Deployment's ConfigMap reference, to the prefixed names.

  34. Question 34. Why does configMapGenerator add a hash suffix to the generated ConfigMap's name?

    1. A content change renames it, so Pods using it roll out
    2. To stop two namespaces using the same name
    3. To encrypt the data stored in the ConfigMap
    4. So Kustomize can detect drift on each apply
    Show answer

    Answer: A. A content change renames it, so Pods using it roll out

    When the data changes, the name changes, Kustomize updates the Deployment's reference, and the template change triggers a rollout.

  35. Question 35. Which kustomization.yaml field applies a strategic merge or JSON 6902 change to a base resource?

    1. overrides
    2. mergeKeys
    3. edits
    4. patches
    Show answer

    Answer: D. patches

    patches accepts strategic merge patches or JSON 6902 patches, inline or from files, with an optional target selector.

  36. Question 36. Which kustomization.yaml field sets the namespace on every resource it outputs?

    1. namePrefix
    2. namespace
    3. labels
    4. scope
    Show answer

    Answer: B. namespace

    namespace: prod sets metadata.namespace on all namespaced resources, overriding any value already in them.

  37. Question 37. How do Helm and Kustomize differ in approach?

    1. Helm patches plain YAML; Kustomize uses templates
    2. Helm runs in the cluster; Kustomize only in CI
    3. Helm uses templates and values; Kustomize patches plain YAML
    4. Kustomize installs releases with rollback history
    Show answer

    Answer: C. Helm uses templates and values; Kustomize patches plain YAML

    Helm renders Go templates from values and tracks releases. Kustomize layers overlays and patches on plain manifests, with no templating.

  38. Question 38. Which command applies every manifest in the directory ./k8s?

    1. kubectl apply --dir ./k8s
    2. kubectl run -f ./k8s
    3. kubectl create -k ./k8s
    4. kubectl apply -f ./k8s/
    Show answer

    Answer: D. kubectl apply -f ./k8s/

    -f accepts a directory and applies each manifest in it; add -R to recurse into subdirectories.

  39. Question 39. Which command shows what would change in the cluster if a manifest were applied?

    1. kubectl apply -f app.yaml --compare
    2. kubectl diff -f app.yaml
    3. kubectl get -f app.yaml --changes
    4. kubectl rollout status -f app.yaml
    Show answer

    Answer: B. kubectl diff -f app.yaml

    kubectl diff does a server-side dry run and prints a diff between the live objects and the manifest.

  40. Question 40. Which command blocks until Deployment web reports that it is available?

    1. kubectl wait --for=condition=Available deployment/web
    2. kubectl get deployment web --until=Available
    3. kubectl rollout pause deployment/web --wait
    4. kubectl describe deployment web --watch
    Show answer

    Answer: A. kubectl wait --for=condition=Available deployment/web

    kubectl wait waits for a condition on one or more objects, with --timeout to cap the wait.

CKAD, Certified Kubernetes Application Developer, and Kubernetes are trademarks of The Linux Foundation. These questions are original study material, not questions from the real exam.