Skip to content

Certified Kubernetes Application Developer (CKAD) - Practice Questions

30 questions for CKAD prep, weighted toward configuration and security (25%) with design, deployment, and networking at 20% each, and observability and maintenance at 15%.

CKAD is performance-based, so these are conceptual reinforcement. Nothing replaces typing kubectl under a timer.

Cert page: exams/kubernetes/ckad/


Question 1

Scenario: An application container needs a configuration file generated by another process before it starts. The generator runs for about 10 seconds and then exits. What pattern fits?

A. A separate Job in the same namespace that runs the generator, relying on the app pod to find the file afterwards B. An init container that runs to completion before the app container starts C. A postStart lifecycle hook on the app container that launches the generator as the container starts D. A sidecar container running alongside the app that keeps the generator running for the life of the pod

Answer **Correct: B** **Why:** Init containers run to completion in order, before any app container starts, and share volumes with them. That is exactly a "prepare something then exit" task. A sidecar runs concurrently and would not guarantee the file exists at app start. A separate Job has no shared volume and no ordering guarantee. A `postStart` hook runs after the container has already started, which is too late.

Question 2

Scenario: A Deployment has replicas: 10, maxUnavailable: 0, and maxSurge: 1. How does a rolling update behave?

A. All 10 pods are replaced at the same moment, causing a brief outage while the new replicas start B. Up to 11 pods exist at a time, and available capacity never falls under 10 C. Up to 10 pods exist and 1 is unavailable at a time, so capacity dips to 9 during each replacement D. The update is rejected as invalid, because maxSurge must be 0 whenever maxUnavailable is 0

Answer **Correct: B** **Why:** `maxUnavailable: 0` forbids dropping below the desired count, so a new pod must become ready before an old one is removed. `maxSurge: 1` allows one extra pod above desired, so the peak is 11. This is the safest but slowest setting. Note that both cannot be zero, since that would make progress impossible.

Question 3

Scenario: A pod must read a database password without the value appearing in the pod spec or in kubectl get pod -o yaml output as plaintext you typed.

A. Put the value in a Secret and reference it with secretKeyRef in env, so RBAC controls who can read the value B. Put the value in a ConfigMap and mount it as a file, since ConfigMaps are encrypted at rest by default C. Store it in a pod annotation, which the API server hides from kubectl get output for non-admin users D. Hard-code it as a container arg in the manifest and rely on the image registry's access controls and private repository settings to protect it

Answer **Correct: A** **Why:** A Secret keeps the value out of the workload manifest and lets RBAC control who can read it. ConfigMaps are for non-confidential data and get no special access treatment. Args and annotations are plainly visible in the pod spec. Be honest about the limit: Secrets are base64-encoded, not encrypted, unless encryption at rest is enabled on etcd.

Question 4

Scenario: A pod's readiness probe fails intermittently under load. What is the observable effect?

A. The pod is evicted from the node, because a failing readiness probe signals node pressure to the kubelet B. The container is restarted by the kubelet each time the probe fails, as with a liveness probe C. The pod is taken out of the Service endpoints until the probe passes again, but the container keeps running and is not restarted D. The Deployment rolls back to the previous ReplicaSet as soon as one pod reports not ready

Answer **Correct: C** **Why:** Readiness controls endpoint membership only. A failing readiness probe pulls the pod out of load balancing but leaves it running, which is the intended behavior for a temporarily overloaded pod. Restarting on failure is what a liveness probe does, and confusing the two is the classic CKAD mistake: a liveness probe that is really a readiness check will restart-loop a busy app.

Question 5

Scenario: A CronJob should never run two instances at once, even if one run overruns its schedule.

A. Set successfulJobsHistoryLimit: 1, so only one finished Job is kept and later runs wait for it to be cleaned up B. Set concurrencyPolicy: Forbid, so overlapping runs are skipped C. Set suspend: true, which pauses new runs while the current one finishes and then resumes automatically D. Set concurrencyPolicy: Replace, which cancels the running Job so the new run can start

Answer **Correct: B** **Why:** `Forbid` skips the new run if the previous one is still active. `Replace` also avoids overlap but kills the running job to start the new one, which is different behavior and usually wrong for work you do not want interrupted. `suspend` stops scheduling entirely. The history limit only controls how many finished Jobs are retained.

Question 6

Scenario: Two containers in the same pod need to share files. Which volume type is the simplest fit?

A. emptyDir mounted into both containers of the pod B. persistentVolumeClaim bound to a PersistentVolume provisioned by a StorageClass for the pod C. configMap volume populated with the files that each container writes at runtime D. downwardAPI volume exposing pod labels and annotations as files

Answer **Correct: A** **Why:** `emptyDir` is created when the pod is scheduled and lives as long as the pod, which matches intra-pod sharing exactly. A PVC works but adds a storage dependency you do not need for ephemeral data. `hostPath` couples the pod to a node and is a security concern. `downwardAPI` volumes only expose pod metadata, and `configMap` volumes are read-only.

Question 7

Scenario: A NetworkPolicy is applied selecting the api pods with policyTypes: [Ingress] and one rule allowing traffic from frontend pods. What happens to the api pods' outbound traffic?

A. It depends on the CNI plugin, because each plugin chooses its own default for the direction not listed B. It is blocked, because the pod is now isolated both ways C. It is allowed only to frontend, because the rule's peer applies to the pod's traffic in each direction D. It is unaffected, because only the listed Ingress direction is restricted

Answer **Correct: D** **Why:** A NetworkPolicy only restricts the directions listed in `policyTypes`. Declaring Ingress alone leaves egress completely open. This is why "we added a NetworkPolicy" is not the same as "the pod is isolated." To restrict outbound you must add an Egress policy, and note that a default-deny egress policy usually needs an explicit allow for DNS to kube-dns on port 53.

Question 8

Scenario: A container must not run as root and must not be able to gain additional privileges.

A. securityContext.runAsNonRoot: true and allowPrivilegeEscalation: false B. A PodDisruptionBudget with minAvailable: 1, which limits how many pods voluntary disruptions can remove C. A ResourceQuota on the namespace that caps the CPU and memory the pods may request in total D. securityContext.privileged: false to disable privileged mode

Answer **Correct: A** **Why:** `runAsNonRoot` makes the kubelet refuse to start a container whose image would run as UID 0, and `allowPrivilegeEscalation: false` sets the `no_new_privs` flag so setuid binaries cannot escalate. `privileged: false` is already the default and does not cover either requirement. PDBs govern voluntary disruptions and quotas govern resource consumption.

Question 9

Scenario: A pod requests 100m CPU with a limit of 500m. The node is saturated. What happens?

A. The pod gets 500m regardless, because a limit is a guaranteed allocation that the scheduler reserves on the node B. The pod is OOM-killed like a memory overrun C. The pod is throttled toward its request share but keeps running D. The pod is evicted, because a node under CPU pressure always removes pods that exceed their request

Answer **Correct: C** **Why:** CPU is a compressible resource, so contention produces throttling, not termination. Memory is the incompressible one: exceeding a memory limit gets the container OOM-killed. Knowing which resource kills and which merely slows is a frequent exam distinction.

Question 10

Scenario: You need to expose a pod to other pods in the cluster only, with a stable name.

A. NodePort Service, which opens a port on every node and is meant for traffic from outside B. ClusterIP Service, reachable only from inside the cluster through a stable virtual IP and DNS name C. Ingress, which routes external HTTP and HTTPS requests to Services using host and path rules D. LoadBalancer Service, which provisions a cloud load balancer with an external address

Answer **Correct: B** **Why:** ClusterIP is the default and is reachable only inside the cluster, with a DNS name of `..svc.cluster.local`. NodePort and LoadBalancer both expose externally. Ingress is an L7 router that still needs a Service behind it.

Question 11

Scenario: A Job should run 5 completions with at most 2 running at once.

A. backoffLimit: 5, which retries failed pods five times B. completions: 5 and parallelism: 2, so at most two pods run at a time C. replicas: 5, parallelism: 2, as in a Deployment spec D. completions: 2, parallelism: 5, so five pods run at a time until two succeed

Answer **Correct: B** **Why:** `completions` is how many successful pods the Job needs and `parallelism` caps concurrency. Jobs have no `replicas` field. `backoffLimit` is the retry ceiling before the Job is marked failed, which is a different control entirely.

Question 12

Scenario: After kubectl apply of an updated Deployment, you want to watch the rollout and stop it if it stalls.

A. kubectl scale --replicas=0 on the Deployment to remove every pod B. kubectl rollout undo immediately, before checking whether the new ReplicaSet is progressing at all C. kubectl get pods -w then delete the Deployment if pods stay Pending D. kubectl rollout status to watch, then kubectl rollout pause to freeze it

Answer **Correct: D** **Why:** `rollout status` blocks and reports progress, and `rollout pause` freezes the rollout in place so you can inspect without losing the old ReplicaSet. `rollout undo` is the recovery step after you have decided it failed. Deleting or scaling to zero takes the service down, which is a worse outcome than a paused half-rollout.

Question 13

Scenario: A ConfigMap mounted as a volume is updated with kubectl edit. The application does not see the change.

A. You must delete the pod for any volume update to take effect B. ConfigMap volume contents never update after the pod starts C. The files do update eventually, but the process must re-read them or be restarted D. Only Secrets support live updates, because the kubelet refreshes Secret volumes but treats ConfigMaps as immutable

Answer **Correct: C** **Why:** The kubelet refreshes projected ConfigMap and Secret volumes periodically, so the file on disk changes without a restart. What does not happen automatically is the application noticing. Values injected as environment variables are the genuinely static case: those are fixed at container start and require a restart. `subPath` mounts also do not receive updates.

Question 14

Scenario: You need to debug a distroless container that has no shell.

A. kubectl logs -f <pod> to stream the container output while the failure happens B. Rebuild the image with a shell added and redeploy, losing the failing pod's live state C. kubectl debug -it <pod> --image=busybox --target=<container> to attach an ephemeral debug container D. kubectl exec -it <pod> -- sh to open a shell inside the running container

Answer **Correct: C** **Why:** `kubectl debug` attaches an ephemeral container to the running pod, sharing its namespaces, so you get a shell and can see the target's process tree without changing the image. `exec` fails when there is no shell binary. `logs` helps but does not let you inspect the filesystem or network. Rebuilding works but is slow and reintroduces the shell you deliberately removed.

Question 15

Scenario: A team wants one manifest set customized per environment without templating language.

A. Helm with values files, using Go templating in the chart to render the per-environment differences B. kubectl apply with --set flags to override fields for each environment at deploy time C. Separate full copies of each manifest per environment D. Kustomize with overlays patching a common base, built into kubectl -k

Answer **Correct: D** **Why:** Kustomize is deliberately template-free: a base plus per-environment overlays that patch it, built into `kubectl` as `-k`. Helm is the templating answer and is a fine tool, but the question rules it out. Full copies drift. `kubectl apply` has no `--set` flag.

Question 16

Scenario: A team builds an image for a Go service. The final image currently contains the full compiler toolchain and is 900 MB. They want a small runtime image without changing the application code.

A. Use a multi-stage Dockerfile that compiles in a builder stage and copies only the binary into a minimal final stage B. Add a RUN rm -rf step at the end of the single-stage Dockerfile to delete the toolchain after the build C. Squash the image layers with an external tool so the toolchain files are compressed into one layer D. Set imagePullPolicy: IfNotPresent on the pod so the large image is downloaded only once per node and then reused from the node cache

Answer **Correct: A** **Why:** A multi-stage build keeps the compiler in a throwaway stage and copies only the built binary into a small base, so the toolchain never reaches the final image. Deleting files in a later `RUN` step does not shrink the image, because the earlier layer that added them is still part of it. Squashing can help a little but still ships whatever the final filesystem holds and adds tooling for no benefit over a multi-stage build. `imagePullPolicy` changes when the image is pulled, not how big it is.

Question 17

Scenario: A log-shipping helper must start before the main app container, keep running for the whole life of the pod, and be stopped after the app container on shutdown. The cluster runs a current Kubernetes version.

A. A second regular container in the pod spec, listed before the app container so it starts first B. A postStart hook on the app container that launches the shipper as a background process C. A DaemonSet on every node that tails the app container's log files from the host path D. An init container with restartPolicy: Always, which Kubernetes treats as a native sidecar

Answer **Correct: D** **Why:** An init container with `restartPolicy: Always` is a native sidecar: it starts before the app containers, keeps running, and is shut down after them. Regular containers start in parallel with no ordering guarantee, so listing it first does not help. A `postStart` hook runs inside the app container and dies with it, with no restart or ordering control. A DaemonSet is a valid node-level logging design, but it is not part of the pod and does not meet the start-before and stop-after requirement.

Question 18

Scenario: A batch Job processes a queue. If a pod fails three times, the Job should stop retrying, and the whole Job must be killed if it runs longer than 10 minutes.

A. Set restartPolicy: Always on the pod and ttlSecondsAfterFinished: 600 on the Job B. Set backoffLimit: 3 and activeDeadlineSeconds: 600 on the Job C. Set completions: 3 and parallelism: 1 on the Job with a 600-second readiness probe D. Wrap the Job in a CronJob with startingDeadlineSeconds: 600 and concurrencyPolicy: Forbid

Answer **Correct: B** **Why:** `backoffLimit` caps the number of retries before the Job is marked failed, and `activeDeadlineSeconds` terminates the whole Job once it runs past the deadline. Jobs do not accept `restartPolicy: Always`, and `ttlSecondsAfterFinished` only cleans up a Job after it finishes. `completions` sets how many successful pods are needed, not how many failures are allowed, and a readiness probe has nothing to do with time limits. `startingDeadlineSeconds` on a CronJob is about how late a run may start, not how long it may run.

Question 19

Scenario: A new version of a web app should get about 10% of traffic before full rollout. There is no service mesh or ingress controller with traffic-splitting features, only plain Deployments and a Service.

A. Set maxSurge: 10% on the existing Deployment so only a tenth of the pods are replaced B. Create a second Service pointing to the new pods and give it a 10% weight in its spec so kube-proxy splits requests between the two C. Run a second Deployment with the new version and the same Service labels, sized at about one pod in ten D. Pause the rollout with kubectl rollout pause after the first new pod becomes ready and leave it there

Answer **Correct: C** **Why:** A Service spreads traffic across all ready pods matching its selector, so running 1 canary pod beside 9 stable pods sends roughly 10% of requests to the canary. `maxSurge` controls how many extra pods exist during a rollout, not a lasting traffic split. A Service has no weight field. Pausing a rollout can give a rough split for a moment, but it leaves a Deployment half-updated and is a fragile way to run a canary.

Question 20

Scenario: A team installed an app with Helm. The latest upgrade broke it, and they want the previous working release back quickly.

A. kubectl rollout undo on every Deployment the chart created B. helm uninstall followed by helm install with the old values file C. helm rollback <release> <revision> to a known good revision listed in helm history D. Edit the chart's Chart.yaml to set the previous chart version and then run helm upgrade again with the same values

Answer **Correct: C** **Why:** Helm stores each release revision, so `helm history` shows them and `helm rollback` restores the chosen one in one step, including every resource the chart manages. `kubectl rollout undo` only reverts Deployments and leaves ConfigMaps, Services and other chart objects at the new version. Uninstalling and reinstalling causes an outage and can delete data the chart owns. Changing `Chart.yaml` alters the chart's metadata, not the release history, and is not a rollback.

Question 21

Scenario: A cluster is being upgraded and a manifest uses an API version that the new release no longer serves. What does the developer need to do?

A. Update the manifest to the supported API version, using kubectl convert or the deprecation guide to map fields B. Nothing, because the API server silently translates removed versions to the newest one on apply C. Add a --force flag to kubectl apply so the old API version is accepted after the upgrade D. Delete the CustomResourceDefinition for that resource type and recreate it with the old version

Answer **Correct: A** **Why:** Once an API version is removed, the API server rejects manifests that use it, so the manifest must move to a served version; the deprecation guide and the `kubectl convert` plugin help map fields. The server converts between versions it still serves, but it cannot accept a version it no longer serves. `--force` changes how apply replaces objects and does not bring back a removed API. Built-in types are not CRDs, and deleting a CRD would delete every object of that type.

Question 22

Scenario: An app takes up to 3 minutes to start. The liveness probe keeps killing it during startup, but once started it should be restarted within 30 seconds if it hangs.

A. Set the liveness probe's initialDelaySeconds to 0 and its failureThreshold to 1 B. Replace the liveness probe with a readiness probe, which never restarts the container C. Raise the liveness probe's periodSeconds to 180 so it checks only once every 3 minutes for the life of the container D. Add a startup probe that allows up to 3 minutes, and keep the liveness probe tight for after startup

Answer **Correct: D** **Why:** A startup probe holds off the liveness and readiness probes until it succeeds, so a slow start gets its own budget while the liveness probe can still detect a hang fast afterwards. A zero delay with one allowed failure makes the startup problem worse. A readiness probe never restarts anything, so a hung process would sit there forever. Checking only every 3 minutes fixes startup but breaks the 30-second detection goal.

Question 23

Scenario: A pod in a namespace with a LimitRange is rejected. The LimitRange sets a maximum of 1 CPU per container, and the container asks for a 2 CPU limit.

A. The pod is admitted but throttled to 1 CPU at runtime by the kubelet B. The pod is rejected at admission because its limit exceeds the LimitRange maximum C. The pod is scheduled to a node with spare capacity outside the namespace's quota D. The LimitRange max is ignored because limits only matter when a ResourceQuota also exists

Answer **Correct: B** **Why:** LimitRange is enforced by an admission controller, so a container limit above the configured maximum is rejected when the pod is created. The kubelet does not quietly lower a limit to match a LimitRange. Scheduling never looks outside the namespace's rules to dodge a policy. LimitRange works on its own; a ResourceQuota is a separate, namespace-wide total.

Question 24

Scenario: A pod needs to call the Kubernetes API to list ConfigMaps in its own namespace and nothing else.

A. Run the pod with the default ServiceAccount and give that account the cluster-admin ClusterRole B. Mount the cluster administrator's kubeconfig as a Secret and point the client at it C. Create a ServiceAccount, a Role allowing get and list on ConfigMaps, and a RoleBinding to that account D. Create a ClusterRole for ConfigMaps and bind it with a ClusterRoleBinding to the pod's ServiceAccount

Answer **Correct: C** **Why:** A dedicated ServiceAccount with a namespaced Role and RoleBinding grants exactly list and get on ConfigMaps in one namespace. `cluster-admin` on the default account grants everything to every pod that uses it. Copying an admin kubeconfig into a Secret hands full cluster control to the pod. A ClusterRoleBinding applies the permission in every namespace, which is broader than asked.

Question 25

Scenario: A team wants Kubernetes to manage a Database object type that their operator reconciles. What must exist before kubectl apply can create a Database resource?

A. A CustomResourceDefinition that registers the Database kind with the API server B. A ConfigMap named database that holds the schema the operator expects C. An annotation on the target namespace declaring that it accepts Database objects from the operator's controller D. A Helm chart named database installed in the kube-system namespace

Answer **Correct: A** **Why:** A CustomResourceDefinition adds a new kind to the API, after which the API server stores and serves `Database` objects and an operator can watch them. A ConfigMap is just data and does not add a type. Namespace annotations cannot register API kinds. Helm may be how the CRD is shipped, but the chart is not what registers the type; the CRD is.

Question 26

Scenario: A container must read its own pod name and namespace at runtime without calling the API server.

A. Query the cluster DNS for the pod's own A record and parse the namespace from it B. Read them from the HOSTNAME environment variable, which always contains both the pod name and the namespace C. Mount the ServiceAccount token and decode it to find the pod and namespace names D. Use the Downward API to expose metadata.name and metadata.namespace as env vars or files

Answer **Correct: D** **Why:** The Downward API exposes pod fields such as `metadata.name` and `metadata.namespace` to the container through `fieldRef` env vars or a volume, with no API call. Pod A records are not created by default in the form needed, and parsing DNS is fragile. `HOSTNAME` is usually the pod name but never the namespace. Decoding a token is a workaround that relies on token internals and is not the supported way.

Question 27

Scenario: An Ingress should send shop.example.com/api to the api Service and everything else on that host to the web Service.

A. One Ingress with a rule for the host, a path /api to api, and a path / to web B. Two Services of type LoadBalancer, one per path, with DNS records for each C. A NetworkPolicy that allows /api traffic to the api pods and the rest to web D. A single ClusterIP Service selecting both the api and web pods by a shared label, with session affinity turned on

Answer **Correct: A** **Why:** Ingress rules match on host and path, so one rule with `/api` and `/` paths routes to the two backends; the more specific path wins. LoadBalancer Services work at layer 4 and know nothing about URL paths. NetworkPolicy allows or blocks traffic by pod, namespace and port, not by HTTP path. One Service over both pod sets would spread requests across them at random.

Question 28

Scenario: After creating a Service, kubectl get endpointslices shows no endpoints, although the pods are running and ready.

A. The Service's selector does not match the pod labels, so no pods are added as endpoints B. The Service type is ClusterIP, which never creates endpoints until it is changed to NodePort C. The pods have no readiness probe, so they are never counted as endpoints D. Cluster DNS is down, and endpoints are only created after the DNS record resolves

Answer **Correct: A** **Why:** Endpoints come from the Service selector matching labels on ready pods; a typo in the selector or labels leaves the list empty, so compare `kubectl get svc -o yaml` with `kubectl get pods --show-labels`. ClusterIP Services get endpoints normally. Pods without a readiness probe are treated as ready once their containers run. DNS resolves the Service name but plays no part in building the endpoint list.

Question 29

Scenario: A NetworkPolicy restricts egress from api pods to the db pods only. Now api cannot resolve any Service name.

A. Egress policies always block DNS, so Service names cannot be used and pods must use IPs B. The policy also needs an egress rule allowing UDP and TCP port 53 to the cluster DNS pods C. The db Service must be changed to a headless Service so names resolve without DNS D. NetworkPolicy only ever applies to ingress traffic, so the cause of the DNS failure must be elsewhere in the cluster

Answer **Correct: B** **Why:** Once a pod has an egress policy, everything not listed is denied, including DNS lookups to CoreDNS; add a rule allowing port 53 over UDP and TCP to the DNS pods. You can keep using Service names once DNS is allowed. A headless Service still relies on DNS to return pod IPs. NetworkPolicy supports `Egress` in `policyTypes`, so it can and does block outbound traffic.

Question 30

Scenario: A StatefulSet's pods must be reachable by stable per-pod DNS names such as db-0.db.

A. A NodePort Service, which assigns each StatefulSet pod its own fixed port and DNS name on every node in the cluster B. An ExternalName Service mapping db to the first pod's IP C. An Ingress with a host rule for every pod ordinal D. A headless Service (clusterIP: None) named in the StatefulSet's serviceName

Answer **Correct: D** **Why:** A headless Service referenced by `serviceName` gives each StatefulSet pod its own DNS record, such as `db-0.db..svc`. NodePort exposes one port for the whole Service, not per pod. ExternalName maps a name to an external DNS name, not to pod IPs. Ingress handles HTTP from outside the cluster and does not create per-pod DNS names.

Where to go deeper