Explore / Exam Prep for the Certified Kubernetes Application Developer (CKAD) / Practice questions
Certified Kubernetes Application Developer (CKAD) practice questions
10 questions from the bank behind this course's timed mock. Free to read and to answer, no account needed, and each has its answer and an explanation. They belong to Exam Prep for the Certified Kubernetes Application Developer (CKAD).
Answer them one at a time →Read lesson 1 free
Question 1
You are 40 minutes into your CKAD attempt and have finished 5 tasks. You have spent the last 15 minutes on one difficult task and it still does not work. About 12 tasks are left. Your goal is the highest possible score. What is the best thing to do next?
- Flag the task, move on to the remaining tasks, and come back to it if time is left, because about 7 minutes per task is the budget and other tasks may earn more points
- Stop the session and use your included retake, because it lets you start again with fresh tasks
- Keep working on the task until it is solved, because the exam only scores tasks that are fully finished
- Spend the remaining time checking your 5 finished tasks, because a 66% pass mark rewards accuracy over attempting more tasks
Show the answer
Answer: A. Flag the task, move on to the remaining tasks, and come back to it if time is left, because about 7 minutes per task is the budget and other tasks may earn more points
120 minutes across about 17 tasks is roughly 7 minutes each, and one hard task should not use up time that could earn points elsewhere. Going back over the 5 finished tasks is also wrong: with 12 tasks not yet attempted, you cannot reach 66% from 5 tasks.
Question 2
You are a developer on the payments team. Image `pay:1.4` was built from a Dockerfile that ends with `ENTRYPOINT ["sh", "/app/app.sh"]` and has no CMD. You must not rebuild the image. For one debugging Pod, the container should run `sh -c "echo debug; sleep 3600"` and should not run the script at all. What is the best way to do this in the Pod spec?
- Set `command: ["sh", "-c", "echo debug; sleep 3600"]` on the container
- Set the environment variable `GREETING` to `debug` on the container
- Set `imagePullPolicy: Never` so the kubelet uses the local image's default command
- Set `args: ["sh", "-c", "echo debug; sleep 3600"]` on the container
Show the answer
Answer: A. Set `command: ["sh", "-c", "echo debug; sleep 3600"]` on the container
In a Pod, `command` replaces the image's ENTRYPOINT, so the script never runs. `args` only replaces CMD, so the ENTRYPOINT `sh /app/app.sh` would still run, with your values passed to it as arguments.
Question 3
A developer deploys Pod 'etl' with a generic ephemeral volume named 'work' that uses a volumeClaimTemplate requesting 5Gi. A colleague runs kubectl get pvc to find the claim and asks what will happen to it later. Which statement is correct?
- A PVC named 'etl-work' is created, the Pod is set as its owner, and the PVC is deleted when the Pod is deleted
- A PVC named 'work' is created and stays after the Pod is deleted, so it can be reused by the next Pod
- No PVC is created, because generic ephemeral volumes are backed by a node-local emptyDir
- A PVC named 'etl-work' is created but must be deleted by hand after the Pod is removed
Show the answer
Answer: A. A PVC named 'etl-work' is created, the Pod is set as its owner, and the PVC is deleted when the Pod is deleted
Kubernetes names the claim <pod>-<volume> and makes the Pod its owner, so the claim is deleted together with the Pod. The 'delete by hand' option gets the name right but misses the ownership that cleans the claim up automatically.
Question 4
You are a developer on the `shop` team. Blue (`app=web,version=blue`) and green (`app=web,version=green`) Deployments are both running with 3 ready replicas each. You switch traffic to green with `kubectl patch service web -p '{"spec":{"selector":{"version":"gren"}}}'`. Users immediately report that the site is down, and `kubectl get endpointslices -l kubernetes.io/service-name=web` shows no endpoint IPs. What is the most likely cause, and how do you fix it?
- The EndpointSlice controller needs a restart. Delete the EndpointSlice so that Kubernetes recreates it.
- The green Pods are not ready yet. Run `kubectl rollout undo deployment web-green`.
- The selector value `gren` matches no Pods. Patch the selector again with the correct value `green`.
- The patch deleted the `app: web` key from the selector. Recreate the Service with `kubectl expose`.
Show the answer
Answer: C. The selector value `gren` matches no Pods. Patch the selector again with the correct value `green`.
No Pod carries the label `version=gren`, so the Service has zero endpoints. Patching the correct value fixes it straight away. A patch merges map keys, so `app: web` was kept, which rules out the option that says the patch deleted it.
Question 5
You are a developer on the payments team. The base in ~/pay/base defines a Deployment named web. Your overlay sets namePrefix: prod- and lists replicas-patch.yaml under patches. The patch file is a partial Deployment manifest with metadata.name: prod-web and spec.replicas: 3. When you run kubectl kustomize on the overlay, the patch does not apply to the Deployment. What is the best fix?
- Add a target block to the patch entry with name: prod-web.
- Move namePrefix: prod- below the patches field so the prefix is applied after the patch.
- Rewrite the patch as a JSON 6902 operation with path /metadata/name/prod-web/spec/replicas.
- Change metadata.name in the patch file to web, the name used in the base.
Show the answer
Answer: D. Change metadata.name in the patch file to web, the name used in the base.
A strategic merge patch finds its target from its own apiVersion, kind and metadata.name, and that name must be the base name (web), not the prefixed one. A target block naming prod-web keeps the same wrong name, and the order of fields in kustomization.yaml does not change how the patch is matched.
Question 6
You are a developer on a team. A ticket asks you to give container `worker` a CPU request of half a core and a memory request of exactly 256 mebibytes (powers of two). Which `resources.requests` block meets the requirement?
- cpu: 500 memory: 256Mi
- cpu: 500m memory: 256M
- cpu: 0.5m memory: 256Mi
- cpu: 500m memory: 256Mi
Show the answer
Answer: D. cpu: 500m memory: 256Mi
Half a core is 500m (1 core = 1000m), and `Mi` is the power-of-two suffix for mebibytes. `256M` is the nearest wrong option: `M` is a power-of-ten suffix, so it is a smaller amount than 256Mi.
Question 7
You are the on-call developer. You rotated the value of key `pass` in Secret `db-cred`. Pod `app` was started before the change. It reads the password in two ways: as env var `DB_PASS` through `secretKeyRef`, and as the file `/etc/creds/pass` from a Secret volume mounted at `/etc/creds` without `subPath`. You do not restart the Pod. Which statements are true? (Select TWO.)
More than one answer is right.
- A copy of the same key mounted with `subPath` would also receive the new value automatically.
- Inside the running container, `DB_PASS` keeps the old value until the container restarts.
- `/etc/creds/pass` is eventually updated to the new value without a restart.
- Setting `immutable: true` on the Secret would push the new value to running containers faster.
- `DB_PASS` is refreshed automatically the next time the kubelet syncs the Pod.
Show the answer
Answers: B. Inside the running container, `DB_PASS` keeps the old value until the container restarts.; C. `/etc/creds/pass` is eventually updated to the new value without a restart.
Environment variables are fixed when the container starts, but files from a Secret volume are updated when the Secret changes. The exception is a file mounted with `subPath`, which does not receive updates. `immutable: true` blocks changes to the Secret; it does not spread them faster.
Question 8
You are a developer running a client Pod in namespace `dev`. Namespace `dev` has a Service named `web`, and namespace `shop` also has a Service named `web`. The client's config sets its backend host to just `web`. Pods use the default kubelet-generated `/etc/resolv.conf`. Which Service will the client reach?
- Neither. CoreDNS returns an error because the short name matches Services in two namespaces
- The `web` Service in `dev`, because the first search domain is `dev.svc.cluster.local`
- Both, because CoreDNS returns the ClusterIPs of both Services and the client alternates between them
- The `web` Service in `shop`, because short names resolve across all namespaces in alphabetical order
Show the answer
Answer: B. The `web` Service in `dev`, because the first search domain is `dev.svc.cluster.local`
A short name expands only through the Pod's own namespace search domain first (`web.dev.svc.cluster.local`), so it resolves to the Service in `dev`. A short name never reaches `shop`'s `web`; you need `web.shop` or the full name for that.
Question 9
A developer uses an old local cluster for CKAD practice. They apply a default-deny ingress policy (podSelector: {}, policyTypes: [Ingress]) in namespace shop. kubectl reports "networkpolicy.networking.k8s.io/default-deny-ingress created" with no errors, but `kubectl exec other -- wget -qO- -T 2 http://web` still returns the nginx page. What is the most likely cause?
- The cluster's network plugin does not enforce NetworkPolicy, so the API server stores the object and nothing blocks the traffic
- The policy leaves out ingress rules, so Kubernetes treats it as allow-all for ingress
- A default-deny policy only takes effect after the selected Pods are restarted
- policyTypes must list both Ingress and Egress before any isolation is applied
Show the answer
Answer: A. The cluster's network plugin does not enforce NetworkPolicy, so the API server stores the object and nothing blocks the traffic
A NetworkPolicy only works if the CNI enforces it, and the API server accepts the object either way without any warning. Having no ingress rules is exactly what makes a policy deny all ingress, so it does not mean allow-all.
Question 10
You are a developer fixing a Pod named `api-7c9d8f6b5-x2kqp` in namespace `shop`. You must list only the Warning events for this one Pod, oldest first, and you cannot add a `--sort-by` flag. Which command does this?
- kubectl events -n shop --for pod/api-7c9d8f6b5-x2kqp --types=Warning
- kubectl get events -n shop --for pod/api-7c9d8f6b5-x2kqp --types=Warning
- kubectl describe pod api-7c9d8f6b5-x2kqp -n shop
- kubectl get events -n shop --field-selector involvedObject.name=api-7c9d8f6b5-x2kqp,type=Warning
Show the answer
Answer: A. kubectl events -n shop --for pod/api-7c9d8f6b5-x2kqp --types=Warning
`kubectl events` sorts events oldest first by default, `--for` limits it to one object and `--types=Warning` removes Normal events. The `get events` field-selector command picks the right events, but plain `get events` does not sort by time, so the order is not guaranteed.
The full timed mock
50 questions in 75 minutes, with a pass mark of 66%. Each paper is drawn from a bank of questions written for the mock alone, and these 10 are left out of it. Full access opens it, with every level of the course.
LevelUpWith is independent of the organisation that sets this exam. These questions were written for this course; they are not taken from the exam.