Mock Exam: CKAD

Topics Covered

Part 1: Application Design and Build

Exam conditions

Setting up your terminal

How grading works

Timing checkpoint

Task 1 (6 percent): Pod with a native sidecar log shipper

Task 2 (4 percent): Parallel Job with limits

Task 3 (5 percent): CronJob with a concurrency rule

Task 4 (5 percent): Build and export a container image

Reviewing this section

Exam conditions

Set a timer for 120 minutes and work in a terminal against a practice cluster, with only the official Kubernetes documentation open in one browser tab. No notes, no search engine and no AI tools. The mock has 17 tasks spread over five sections in roughly the proportions of the real exam: application design and build about 20 percent, deployment about 20 percent, observability and maintenance about 15 percent, environment, configuration and security about 25 percent, and services and networking about 20 percent. Each task states its weight. The tasks are original practice tasks; none is taken from the real exam.

Every task names a context and a namespace. Run the kubectl config use-context line for the task before anything else, even when you think you are already on the right cluster. A correct answer applied to the wrong cluster scores zero, and the grader does not look for it elsewhere. Pass -n on every command, or set the namespace on the context, rather than trusting what the previous task left behind.

Setting up your terminal

Spend the first minute on the setup you practised in the kubectl speed lesson, then stop tuning and start working. A short block like this pays for itself many times over:

bash
1alias k=kubectl
2export do="--dry-run=client -o yaml"
3export now="--force --grace-period 0"
4source <(kubectl completion bash)
5complete -o default -F __start_kubectl k

Write every manifest to a file named after the task, such as 1.yaml or 11.yaml. If you need to come back, the file is your starting point, and you will not have to rebuild the object from memory.

How grading works

Graders check end state: the object exists in the right namespace with the right fields, the pod is running, the file contains the right value. Partial credit is common on multi part tasks, so a task you cannot finish is still worth starting. Do not delete objects you were not asked to touch, and do not change names; a resource named log_shipper instead of log-shipper is a different resource. When a task asks you to write something to a file, write exactly that value with no extra text.

Timing checkpoint

This section is worth 20 percent. Start it around minute 2 and aim to finish it by about minute 24. A useful pace is a little over one minute per percent of weight, which leaves around ten minutes at the end for flagged tasks. If a task has eaten twice its share of time, write down what is left, move on and come back. Task 4 runs on a separate host, so it is a good one to batch: do it when you feel your kubectl rhythm slipping.

Task 1 (6 percent): Pod with a native sidecar log shipper

Context ckad-a, namespace mercury.

Create a pod named log-shipper in namespace mercury. The main container is named web, uses image nginx:1.27 and writes its access log to /var/log/nginx. Add a native sidecar container named tailer with image busybox:1.36 that runs tail -F /var/log/nginx/access.log, starts before web and keeps running for the life of the pod. Both containers share an emptyDir volume named logs mounted at /var/log/nginx.

Approach: A native sidecar is an entry under initContainers with restartPolicy: Always. Generate the skeleton with kubectl run --dry-run=client -o yaml, then add the volume, both mounts and the init container by hand. Remember that nginx images symlink the log files to stdout, so the shared volume replaces that directory with a real one.

Task 2 (4 percent): Parallel Job with limits

Context ckad-a, namespace batch.

Create a Job named checksum in namespace batch with image busybox:1.36 that runs sh -c 'sha256sum /etc/hostname && sleep 5'. The Job must complete 6 times, with at most 2 pods running at once, retry at most 3 times in total, fail if it runs longer than 120 seconds and be deleted automatically 300 seconds after it finishes.

Approach: Create the Job imperatively with --dry-run=client -o yaml, then add five fields under the Job spec, not under the pod template. The five fields map one to one onto the requirements in the order they appear.

Task 3 (5 percent): CronJob with a concurrency rule

Context ckad-a, namespace batch.

Create a CronJob named report-nightly in namespace batch that runs image busybox:1.36 with command sh -c 'date; echo report built' at 02:30 every day. A new run must never start while the previous one is still running. Keep 2 successful and 1 failed job in history. Then trigger one run by hand as a Job named report-manual and confirm it succeeded.

Approach: The imperative kubectl create cronjob command takes --schedule. Concurrency and history limits must be added in the YAML. A manual run uses kubectl create job --from=cronjob/....

Task 4 (5 percent): Build and export a container image

Run on host ckad-build (ssh in, then exit when done).

A Dockerfile is in /opt/course/4/app. Build an image tagged registry.local/inventory:v2 from that directory using the container tool available on the host (podman or docker). Export the image to an archive at /opt/course/4/inventory-v2.tar. Finally list the local images and write the image ID of the new image to /opt/course/4/id.txt.

Approach: Check which tool exists with which podman docker. Both tools accept the same build -t and save -o flags. Use the --format option of images with a filter on the reference, or copy the ID from a plain listing.

Reviewing this section

After the full attempt, compare each task with the expected answer in the written questions below. Mark a task as complete only if every stated requirement holds when you check it now, not when you think you applied it. For every miss, note whether the cause was knowledge (you did not know the field), speed (you ran out of time) or care (wrong namespace, wrong name, typo). Knowledge misses point back to the matching lesson; care misses point to your verification habit.

Context first, every time

Run the use-context line for each task before reading the rest of it; a correct answer on the wrong cluster scores nothing.