CKAD Domain 1: Application Design and Build
40 free practice questions for Application Design and Build in the Certified Kubernetes Application Developer (CKAD) exam. Try each question first, then open "Show answer" for the correct option and explanation.
Application Design and Build practice questions
-
Question 1. What does a multi-stage Dockerfile build let you do?
Show answer
Answer: B. Copy only the build output into a smaller final image
Earlier stages hold compilers and build tools. The final stage copies only the artifacts it needs (COPY --from=build), so the shipped image is smaller and has less attack surface.
-
Question 2. A Pod spec sets command: ["python"] and args: ["app.py"]. Which Dockerfile instructions do these override?
Show answer
Answer: B. command overrides ENTRYPOINT; args overrides CMD
In Kubernetes, command replaces the image ENTRYPOINT and args replaces CMD. RUN only executes at build time.
-
Question 3. What does the EXPOSE instruction in a Dockerfile do?
Show answer
Answer: C. Documents the port the app listens on; it publishes nothing
EXPOSE is metadata. Kubernetes doesn't need it: a Service or containerPort is what makes the port reachable.
-
Question 4. A container image is referenced as myapp with no tag, and imagePullPolicy isn't set. Which pull policy applies?
Show answer
Answer: C. Always
No tag means :latest, and for :latest (or no tag) the default pull policy is Always. OnFailure isn't a pull policy.
-
Question 5. A container image is referenced as myapp:2.4.1, and imagePullPolicy isn't set. Which pull policy applies?
Show answer
Answer: A. IfNotPresent
For a specific tag other than :latest, the default is IfNotPresent: the kubelet uses a cached copy if the node has one.
-
Question 6. Why pin an image by digest (myapp@sha256:...) instead of by tag?
Show answer
Answer: C. The digest always refers to exactly the same image content
Tags can be moved to a different image. A digest is a content hash, so every node runs the identical image.
-
Question 7. Which command builds an image from the Dockerfile in the current directory and tags it web:1.0?
Show answer
Answer: B. docker build -t web:1.0 .
docker build (or podman build) takes a build context, here '.', and -t sets the name and tag.
-
Question 8. You must copy a built image to another machine as a tar file. Which command creates the file?
Show answer
Answer: D. docker save -o web.tar web:1.0
docker save writes an image with its layers and tags to a tar archive; docker load imports it. docker export works on containers and drops image metadata.
-
Question 9. Which Dockerfile instruction makes the container's main process run as a non-root user?
Show answer
Answer: C. USER 1001
USER sets the user (and optionally group) for later RUN instructions and for the container's process at runtime.
-
Question 10. What is the purpose of a .dockerignore file?
Show answer
Answer: A. It excludes files from the build context sent to the builder
Excluding files such as .git, node_modules, or secrets keeps builds fast and stops them leaking into image layers.
-
Question 11. Why are dependency installs usually placed before COPY of the application source in a Dockerfile?
Show answer
Answer: B. So cached layers are reused when only the code changes
Each instruction is a cached layer. If the source changes but the dependency manifest doesn't, the slow install step is reused from cache.
-
Question 12. Which workload type fits a stateless web front end that should keep three identical replicas running?
Show answer
Answer: D. Deployment
A Deployment manages interchangeable replicas through ReplicaSets and supports rolling updates and rollbacks.
-
Question 13. A CronJob's previous run is still going when the next scheduled time arrives. Which setting skips the new run?
Show answer
Answer: B. concurrencyPolicy: Forbid
Forbid skips the new run while one is active. Replace stops the running Job and starts a new one. Allow, the default, runs them side by side.
-
Question 14. What does concurrencyPolicy: Replace do on a CronJob?
Show answer
Answer: C. Stops the running Job and starts the new one
Replace cancels the still-running Job and replaces it with the newly scheduled one.
-
Question 15. A Job must succeed 10 times, with at most 3 Pods running at once. Which fields set this?
Show answer
Answer: D. completions: 10 and parallelism: 3
completions is the number of successful Pods required; parallelism caps how many run at the same time.
-
Question 16. Which restartPolicy values are allowed in a Job's Pod template?
Show answer
Answer: B. OnFailure or Never
A Job's Pods must eventually finish, so Always is rejected. OnFailure restarts the container in place; Never creates a new Pod on failure.
-
Question 17. A Job's Pods keep failing. Which field caps the retries before the Job is marked as failed?
Show answer
Answer: C. backoffLimit
backoffLimit (default 6) is the number of retries, with exponential back-off between them, before the Job fails.
-
Question 18. Which Job field stops the Job, and terminates its running Pods, once it has run for a set time?
Show answer
Answer: A. activeDeadlineSeconds
activeDeadlineSeconds applies to the whole Job and takes precedence over backoffLimit. startingDeadlineSeconds is a CronJob field about late starts.
-
Question 19. Which field deletes a finished Job and its Pods automatically after a delay?
Show answer
Answer: B. ttlSecondsAfterFinished
The TTL-after-finished controller deletes the Job (and its dependent Pods) that many seconds after it completes or fails.
-
Question 20. Which command runs a CronJob's Job immediately, for testing, without waiting for the schedule?
Show answer
Answer: C. kubectl create job test-run --from=cronjob/report
kubectl create job --from=cronjob/<name> creates a Job from the CronJob's jobTemplate.
-
Question 21. A CronJob has schedule: "*/15 * * * *". When does it run?
Show answer
Answer: D. Every 15 minutes
The first field is minutes, and */15 means every 15 minutes (0, 15, 30, 45). "15 * * * *" would mean 15 minutes past each hour.
-
Question 22. Which CronJob field sets the time zone its schedule is interpreted in?
Show answer
Answer: B. spec.timeZone, such as Europe/London
spec.timeZone takes an IANA time zone name. Without it, the schedule uses the kube-controller-manager's local time zone.
-
Question 23. What does an indexed Job (completionMode: Indexed) give each of its Pods?
Show answer
Answer: C. A completion index in the JOB_COMPLETION_INDEX variable
Each Pod gets an index from 0 to completions-1, in an annotation and the JOB_COMPLETION_INDEX environment variable, so it can pick its share of the work.
-
Question 24. Which containers run to completion before a Pod's app containers start?
Show answer
Answer: C. Init containers
Init containers run before the app containers, for example to wait for a dependency or prepare files on a shared volume.
-
Question 25. A Pod has two init containers. How do they run?
Show answer
Answer: B. One at a time, in order; each must succeed first
Init containers run sequentially. If one fails, the kubelet retries it according to the Pod's restartPolicy, and later ones don't start.
-
Question 26. Which pattern adds a helper container that ships the app's log files to a central logging system?
Show answer
Answer: A. Sidecar
A sidecar runs alongside the main container for the Pod's lifetime, here reading logs from a shared volume and forwarding them.
-
Question 27. How do you declare a native sidecar container that starts before the app containers and keeps running?
Show answer
Answer: B. An init container with restartPolicy: Always
An init container with restartPolicy: Always starts before the app containers, keeps running alongside them, and is stopped after them.
-
Question 28. Which pattern uses a helper container to convert the app's metrics into the format a monitoring system expects?
Show answer
Answer: C. Adapter
An adapter standardizes or transforms the main container's output for outside consumers.
-
Question 29. Which pattern uses a local proxy container, so the app connects to localhost while the proxy handles the remote database?
Show answer
Answer: B. Ambassador
An ambassador proxies outbound connections, hiding details such as sharding, TLS, or service discovery from the app.
-
Question 30. What is the simplest way for two containers in the same Pod to share files?
Show answer
Answer: C. Mount the same emptyDir volume in both
Volumes are defined at Pod level and can be mounted into any of its containers. An emptyDir lives as long as the Pod.
-
Question 31. Two containers in one Pod need to talk over the network. Which address does one use to reach the other?
Show answer
Answer: A. localhost and the other container's port
Containers in a Pod share one network namespace and IP, so they reach each other on localhost. They can't both listen on the same port.
-
Question 32. Which emptyDir setting keeps the volume in memory instead of on the node's disk?
Show answer
Answer: D. medium: Memory
medium: Memory backs the emptyDir with tmpfs. Its contents count against the container's memory limit.
-
Question 33. An app needs its own Pod name as an environment variable. What provides it?
Show answer
Answer: B. The downward API, with fieldRef metadata.name
The downward API exposes Pod fields (name, namespace, IP, labels) and resource values as environment variables or files.
-
Question 34. Which volume type combines data from a ConfigMap, a Secret, and the downward API into one mounted directory?
Show answer
Answer: B. projected
A projected volume maps several sources (configMap, secret, downwardAPI, serviceAccountToken) into one directory.
-
Question 35. A ConfigMap key is mounted into a container using subPath. What happens when the ConfigMap changes?
Show answer
Answer: A. The mounted file is never updated
Files mounted with subPath don't receive ConfigMap or Secret updates. Restart the Pod, or mount the whole volume without subPath.
-
Question 36. Which volume gives a Pod scratch storage provisioned through a StorageClass and deleted along with the Pod?
Show answer
Answer: D. A generic ephemeral volume
A generic ephemeral volume embeds a PVC template in the Pod. The PVC is created with the Pod and removed when the Pod is deleted.
-
Question 37. Which volumeMounts field mounts a volume so the container can't write to it?
Show answer
Answer: B. readOnly: true
readOnly: true on the volumeMount makes the mount read-only. accessModes belongs to PVs and PVCs, not mounts.
-
Question 38. A Deployment with one shared ReadWriteOnce PVC is scaled from 1 to 3 replicas. Why can this fail?
Show answer
Answer: C. Only Pods on the node that attached it can use the volume
ReadWriteOnce allows one node to mount the volume. Replicas scheduled to other nodes get stuck in ContainerCreating with attach errors.
-
Question 39. Which container field sets the working directory, overriding the image's WORKDIR?
Show answer
Answer: D. workingDir
workingDir sets the directory the container's process starts in.
-
Question 40. Which command creates a Pod named box that runs busybox with the command sleep 3600?
Show answer
Answer: B. kubectl run box --image=busybox -- sleep 3600
Everything after -- is passed to the container as args (with --command, as the command). kubectl create has no pod subcommand.
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.