Courseiva

CCNA Application Design and Build Questions

62 questions · Application Design and Build · All types, answers revealed

1
Multi-Selectmedium

Which TWO of the following are valid fields in a Job spec? (Select TWO.)

Select 2 answers
A.replicas
B.backoffLimit
C.schedule
D.restartPolicy
E.parallelism
AnswersB, E

Specifies the number of retries before marking the Job as failed.

Why this answer

Options B (backoffLimit) and E (parallelism) are correct fields in a Job spec. 'backoffLimit' controls the number of retries before marking the Job as failed, and 'parallelism' specifies the maximum number of Pods running in parallel. Option A (replicas) is a field for Deployments, not Jobs. Option C (schedule) is used in CronJobs.

Option D (restartPolicy) is a Pod-level field; in Jobs, the restartPolicy is defaulted to OnFailure or Never but is not a top-level Job spec field.

2
Multi-Selectmedium

A developer is creating a CronJob that should not start a new job if the previous one is still running. Which TWO configurations achieve this? (Select exactly 2.)

Select 2 answers
A.Set concurrencyPolicy: Allow
B.Set startingDeadlineSeconds to a low value
C.Set concurrencyPolicy: Replace
D.Set concurrencyPolicy: Forbid
E.Use a schedule that ensures jobs finish before the next scheduled time
AnswersD, E

Forbid prevents new job creation while a previous job is still running.

Why this answer

Setting `concurrencyPolicy: Forbid` explicitly tells Kubernetes to skip creating a new job if the previous job from the CronJob is still running. This prevents overlapping executions, which is exactly the requirement. The `Forbid` policy is the standard Kubernetes mechanism for ensuring at-most-once execution per scheduled interval.

Exam trap

Kubernetes often tests the distinction between `Forbid` and `Replace` — the trap here is that candidates might think `Replace` prevents a new job from starting, but it actually terminates the old one and starts a new one, which still violates the 'should not start a new job if the previous one is still running' requirement.

3
MCQeasy

Which Kubernetes API version is used for creating a CronJob?

A.batch/v1beta1
B.batch/v1
C.cron/v1
D.apps/v1
AnswerB

batch/v1 is the stable version for CronJob.

Why this answer

CronJob is a Kubernetes resource that was promoted to a stable API version in Kubernetes 1.21. The correct API version for creating a CronJob is batch/v1, as it is the current stable version. The batch/v1beta1 version is deprecated and removed in Kubernetes 1.25, so batch/v1 is the correct choice for CKAD exam scenarios.

Exam trap

The trap here is that candidates may recall the older batch/v1beta1 API version from earlier Kubernetes versions or confuse CronJob with other resources like Deployments (apps/v1), leading them to select a deprecated or incorrect API group.

How to eliminate wrong answers

Option A is wrong because batch/v1beta1 is a deprecated beta API version that was removed in Kubernetes 1.25; using it would fail on modern clusters. Option C is wrong because there is no cron/v1 API group in Kubernetes; CronJobs belong to the batch API group. Option D is wrong because apps/v1 is used for Deployments, StatefulSets, and DaemonSets, not for CronJobs.

4
Matchingmedium

Match each Kubernetes resource to its primary purpose.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Smallest deployable unit running containers

Stable network endpoint for a set of pods

Store non-sensitive configuration data

Request for storage resources

HTTP and HTTPS routing to services

Why these pairings

These are core Kubernetes resources with distinct roles. Pods are the smallest deployable units; Services provide networking abstractions; Deployments manage scaling and updates; ConfigMaps handle configuration data.

5
Multi-Selectmedium

Which TWO of the following are valid concurrencyPolicy values for a CronJob?

Select 2 answers
A.Parallel
B.Forbid
C.Serial
D.Allow
E.Replace
AnswersB, D

Forbid is correct because it is one of the three valid concurrency policies, which prevents concurrent runs by skipping new runs if a previous one is still active.

Why this answer

In Kubernetes, a CronJob's concurrencyPolicy controls how to handle overlapping job executions. The valid values are Allow (default, allowing concurrent runs) and Forbid (skips new run if previous is still running). Among the options given, the two correct answers are Allow and Forbid.

Replace is not a valid concurrencyPolicy value; it is a distractor.

Exam trap

The CKAD exam often tests the exact string values of Kubernetes API fields, and candidates may confuse 'Parallel' or 'Serial' with the valid 'Allow' and 'Forbid' due to familiarity with other job concepts like parallelism.

6
MCQmedium

A user runs 'kubectl run nginx --image=nginx --restart=Never' and the pod goes into 'Pending' state. What is a likely reason?

A.The image name is incorrect
B.The pod is missing a readiness probe
C.The pod's restart policy is set to Never
D.The node has insufficient resources to schedule the pod
AnswerD

Pending means the pod is unschedulable due to resource shortages.

Why this answer

Pending often indicates resource constraints like insufficient CPU or memory.

7
MCQeasy

Which of the following Dockerfile instructions is used to set a command that runs when the container starts and can be overridden by command-line arguments?

A.EXPOSE
B.CMD
C.COPY
D.RUN
AnswerB

CMD provides defaults for an executing container; it can be overridden by providing command-line arguments to docker run.

Why this answer

The CMD instruction in a Dockerfile provides default command(s) for the executing container. When a user runs `docker run image [COMMAND]`, the provided COMMAND overrides the CMD value, making it the correct choice for a command that can be overridden by command-line arguments.

Exam trap

In the CKAD exam, candidates often confuse CMD with ENTRYPOINT. CMD provides default command that can be overridden by command-line arguments, whereas ENTRYPOINT specifies the executable that runs when the container starts and is not overridden unless --entrypoint flag is used.

How to eliminate wrong answers

Option A (EXPOSE) is wrong because it only documents which ports the container listens on at runtime; it does not execute any command. Option C (COPY) is wrong because it copies files from the build context into the image filesystem and has no effect on container startup behavior. Option D (RUN) is wrong because it executes commands during the image build process, creating new layers, and its effects are baked into the image; it cannot be overridden at container start.

8
MCQhard

You need to debug a pod that is not responding. Which command attaches an ephemeral debug container to a running pod named 'web-pod'?

A.kubectl debug web-pod --copy-to=debug-pod --image=busybox
B.kubectl debug -it web-pod --image=busybox --target=web-container
C.kubectl attach web-pod
D.kubectl run debug --image=busybox -it
AnswerB

Correct command to add an ephemeral debug container.

Why this answer

`kubectl debug` with the `--image` flag creates an ephemeral container in the specified pod for interactive debugging. The `-it` flag provides an interactive TTY, and `--target=web-container` attaches the ephemeral container to the same Linux namespace as the target container, allowing direct troubleshooting of the unresponsive pod without modifying its original containers.

Exam trap

The trap here is that candidates confuse `kubectl debug` with `kubectl run` or `kubectl attach`, assuming any command that creates a new interactive shell will work, but only `kubectl debug` with the `--image` flag correctly attaches an ephemeral container to the existing pod without copying or replacing it.

How to eliminate wrong answers

Option A is wrong because `--copy-to=debug-pod` creates a separate copy of the pod (debug-pod) rather than attaching an ephemeral debug container to the existing 'web-pod', which is not what the question asks. Option C is wrong because `kubectl attach` connects to an already running container's stdio, but it cannot create a new debug container; it only attaches to existing containers, which may be unresponsive. Option D is wrong because `kubectl run` creates a new standalone pod named 'debug' instead of attaching an ephemeral container to the existing 'web-pod', so it does not debug the target pod directly.

9
MCQhard

A CronJob is configured with 'concurrencyPolicy: Forbid'. If a job from the previous schedule is still running when the next scheduled time arrives, what happens?

A.The CronJob is suspended
B.The new job starts immediately, and the old job is terminated
C.The new job is skipped until the old job completes
D.Both jobs run concurrently
AnswerC

Forbid skips the new run if a job is still running.

Why this answer

When `concurrencyPolicy: Forbid` is set on a CronJob, the CronJob controller will skip creating a new Job if the previous Job from the last schedule is still running. The new Job is effectively skipped (not queued) until the next scheduled time, preventing overlapping executions. This ensures that only one instance of the Job runs at a time.

Exam trap

The trap here is that candidates confuse 'skipped' with 'queued' or 'delayed' — the CronJob does not wait for the old Job to finish and then start the new one; it simply drops the missed run entirely, which is a key distinction tested in the CKAD exam.

How to eliminate wrong answers

Option A is wrong because the CronJob itself is not suspended; only the new Job creation is skipped. The CronJob continues to evaluate its schedule and will attempt to create Jobs at future intervals. Option B is wrong because the CronJob controller does not terminate the running Job; it simply does not start the new one.

Option D is wrong because `concurrencyPolicy: Forbid` explicitly prevents concurrent runs, so both Jobs cannot run simultaneously.

10
Multi-Selecthard

Which THREE of the following are valid fields in a CronJob specification?

Select 3 answers
A.completions
B.successfulJobsHistoryLimit
C.concurrencyPolicy
D.schedule
E.parallelism
AnswersB, C, D

successfulJobsHistoryLimit limits how many successful finished jobs are retained.

Why this answer

In a CronJob specification, `successfulJobsHistoryLimit` is a valid field that controls how many completed jobs are retained in the cluster's history. This field defaults to 3 and helps manage resource usage by automatically cleaning up old Job records after the limit is exceeded.

Exam trap

In the CKAD exam, a common pitfall is confusing CronJob-level fields with Job template fields. Fields like completions and parallelism belong to the Job template (under jobTemplate.spec), not to the CronJob specification itself.

11
MCQmedium

You need to run a one-time batch job that processes 10 work items in parallel, with a maximum of 3 pods running at the same time. Which Job YAML fields should you set?

A.spec.template.spec.containers and spec.completions
B.spec.parallelism: 10 and spec.completions: 3
C.spec.parallelism: 3 and spec.completions: 10
D.spec.backoffLimit: 3 and spec.completions: 10
AnswerC

parallelism limits concurrent pods, completions defines total successful runs.

Why this answer

`spec.parallelism: 3` limits the maximum number of pods running concurrently, and `spec.completions: 10` ensures the Job runs 10 work items to completion. This combination processes all 10 items in parallel batches of 3, meeting the requirement of a one-time batch job with a maximum of 3 pods at a time.

Exam trap

The trap here is that candidates often confuse `spec.parallelism` with the total number of work items and `spec.completions` with the concurrency limit, leading them to swap the values (e.g., Option B).

How to eliminate wrong answers

Option A is wrong because `spec.template.spec.containers` defines the container image and command, but does not control parallelism or completion count; it is a required field but not sufficient for the given constraints. Option B is wrong because `spec.parallelism: 10` would allow up to 10 pods to run simultaneously, violating the maximum of 3 pods, and `spec.completions: 3` would only require 3 successful completions, not 10 work items. Option D is wrong because `spec.backoffLimit: 3` controls the number of retries before marking the Job as failed, not the parallelism or completion count; it does not address the parallel processing or total work items.

12
MCQhard

You have a multi-stage Docker build. The first stage compiles a binary, and the second stage copies the binary from the first stage. What is the correct COPY syntax to copy a file named 'app' from the first stage named 'builder'?

A.COPY app /app/
B.COPY --from=builder app /app/
C.COPY --stage=builder app /app/
D.COPY source=builder app /app/
AnswerB

--from=builder specifies the source stage.

Why this answer

The `--from=builder` flag in the COPY instruction allows you to copy files from a specific build stage (named 'builder') in a multi-stage Docker build. This syntax is essential for multi-stage builds, where the first stage compiles artifacts and the second stage copies only the necessary binaries, reducing final image size.

Exam trap

The trap here is that candidates often confuse the `--from` flag with other Docker flags like `--stage` or `source=`, or mistakenly think a simple COPY from the build context will work, failing to recognize that multi-stage builds require explicit stage referencing to access files from previous stages.

How to eliminate wrong answers

Option A is wrong because it copies the file from the build context (the host filesystem), not from the 'builder' stage, which would fail if 'app' is only present in the intermediate stage. Option C is wrong because Docker's COPY instruction does not support a `--stage` flag; the correct flag is `--from`. Option D is wrong because `source=builder` is not a valid COPY syntax; Docker uses `--from=<name>` to reference a previous build stage.

13
MCQhard

A CronJob is configured with concurrencyPolicy: Forbid and schedule: '*/5 * * * *'. The first job takes 7 minutes. What happens when the next scheduled time arrives?

A.The previous job is terminated
B.The new job waits until the previous job completes
C.The new job is skipped
D.A new job is created immediately
AnswerC

Forbid skips the new job if the previous one is still running.

Why this answer

C is correct because when `concurrencyPolicy: Forbid` is set, the CronJob controller skips creating a new job if the previous job is still running at the next scheduled time. Since the first job takes 7 minutes and the schedule is every 5 minutes, the new job is skipped to prevent overlapping executions.

Exam trap

The trap here is that candidates often confuse `Forbid` with `Replace` (which terminates the running job) or assume the new job will queue, but Kubernetes explicitly skips the run without any retry or delay.

How to eliminate wrong answers

Option A is wrong because `concurrencyPolicy: Forbid` does not terminate the running job; it only prevents new jobs from starting. Option B is wrong because `Forbid` does not queue or delay the new job; it simply skips it. Option D is wrong because a new job is not created immediately; the controller checks the policy and skips creation if a job is still active.

14
MCQmedium

A developer wants to debug a running container in a Pod named 'web-app' in namespace 'dev'. Which command attaches an ephemeral container with the 'nicolaka/netshoot' image for network debugging?

A.kubectl debug web-app -n dev --image=nicolaka/netshoot -c debugger
B.kubectl run debugger -n dev --image=nicolaka/netshoot --restart=Never
C.kubectl attach web-app -n dev -c debugger --image=nicolaka/netshoot
D.kubectl exec -n dev web-app --image=nicolaka/netshoot -- /bin/bash
AnswerA

kubectl debug creates an ephemeral container in the pod with the specified image.

Why this answer

`kubectl debug` is the dedicated command for adding an ephemeral container to a running Pod for troubleshooting. The `--image=nicolaka/netshoot` flag specifies the network debugging image, and `-c debugger` names the ephemeral container. This allows the developer to attach to the Pod's network namespace without restarting or modifying the original container.

Exam trap

Kubernetes often tests the distinction between `kubectl debug` (for ephemeral containers) and `kubectl exec` (for existing containers), trapping candidates who think `exec` can add a new container with a different image.

How to eliminate wrong answers

Option B is wrong because `kubectl run` creates a standalone Pod, not an ephemeral container attached to an existing Pod; it does not share the network namespace of 'web-app'. Option C is wrong because `kubectl attach` attaches to a running container's stdio, not to a new container, and it does not support the `--image` flag. Option D is wrong because `kubectl exec` runs a command in an existing container, not a new container with a different image; the `--image` flag is invalid for `kubectl exec`.

15
MCQhard

A multi-stage build has two stages named 'builder' and 'final'. Which instruction copies artifacts from the builder stage to the final stage?

A.COPY --from=builder /app /app
B.FROM builder /app /app
C.COPY builder /app /app
D.ADD --from=builder /app /app
AnswerA

Correct syntax to copy from a previous stage.

Why this answer

In a multi-stage Docker build, the COPY instruction with the --from flag allows you to copy files from a named previous stage (here 'builder') into the current stage ('final'). This is the correct syntax to selectively transfer build artifacts without carrying over intermediate layers or dependencies.

Exam trap

The trap here is that candidates confuse the COPY --from syntax with the ADD instruction or forget the --from flag entirely, assuming COPY alone can reference a stage name, which leads to a build error or unintended host path copy.

How to eliminate wrong answers

Option B is wrong because 'FROM builder /app /app' is not a valid Dockerfile instruction; FROM is used to specify a base image, not to copy files. Option C is wrong because 'COPY builder /app /app' omits the required --from flag, so Docker would interpret 'builder' as a source path on the host filesystem, not as a stage name. Option D is wrong because ADD does not support the --from flag; ADD is used for adding files from URLs or archives, and multi-stage artifact copying is exclusive to COPY --from.

16
Drag & Dropmedium

Arrange the steps to create a Kubernetes Deployment with a rolling update strategy.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

First, define the Deployment in YAML. Then apply it. After an update, modify the YAML and re-apply; kubectl performs rolling update automatically.

17
MCQeasy

Which kubectl command creates a pod named 'nginx' from the image 'nginx:latest'?

A.kubectl run nginx --image=nginx:latest
B.kubectl apply -f pod.yaml
C.kubectl run nginx --image=nginx:latest --restart=Never
D.kubectl create pod nginx --image=nginx:latest
AnswerA, C

Correct: This command creates a Pod named 'nginx' from the specified image in recent Kubernetes versions.

Why this answer

`kubectl run nginx --image=nginx:latest` creates a Pod named 'nginx' by default in recent Kubernetes versions (1.18+). Option C is also correct: adding `--restart=Never` explicitly creates a Pod and is a common practice to ensure a Pod is created rather than a Deployment. Option B is wrong because `kubectl apply -f` requires a YAML file.

Option D is wrong because `kubectl create pod` is not a valid subcommand; the correct imperative command is `kubectl run`.

Exam trap

The CKAD exam often tests the misconception that `kubectl run` always creates a Deployment, but in recent Kubernetes versions (1.18+) the default behavior creates a Pod directly. Additionally, both `kubectl run nginx --image=nginx:latest` and `kubectl run nginx --image=nginx:latest --restart=Never` create a Pod, so either is acceptable. Candidates may incorrectly assume only one is correct.

How to eliminate wrong answers

Option B is wrong because `kubectl apply -f pod.yaml` requires a pre-existing YAML manifest file named `pod.yaml` to be present, and it does not create a Pod from the command line using the `--image` flag. Option C is wrong because `kubectl run nginx --image=nginx:latest --restart=Never` explicitly sets the restart policy to Never, which is unnecessary for a basic Pod creation and deviates from the default behavior; the question does not specify any custom restart policy. Option D is wrong because `kubectl create pod nginx --image=nginx:latest` is not a valid kubectl command — the correct syntax for creating a Pod imperatively is `kubectl run`, not `kubectl create pod`.

18
MCQhard

You have a multi-stage Dockerfile with two stages: 'builder' and 'runtime'. You want to copy artifacts from the builder stage to the runtime stage. Which Dockerfile instruction achieves this?

A.EXPORT builder /app/artifact /app/
B.ADD --from=builder /app/artifact /app/
C.COPY ../builder/artifact /app/
D.COPY --from=builder /app/artifact /app/
AnswerD

--from specifies the source stage.

Why this answer

The COPY instruction with --from=stage-name copies files from a previous build stage.

19
Multi-Selectmedium

Which TWO of the following are valid patterns for sidecar containers in a multi-container pod?

Select 2 answers
A.Adapter
B.Sidecar
C.Ambassador
D.Init container
E.Proxy
AnswersA, B

An adapter standardizes interfaces.

Why this answer

The sidecar pattern involves adding a helper container to a pod. The two common patterns are Adapter and Sidecar. Adapter pattern standardizes output, while Sidecar pattern provides auxiliary functionality.

Ambassador is also a sidecar pattern, but this question specifically asks for two correct answers among the options, and Adapter and Sidecar are the correct choices.

20
Multi-Selectmedium

Which TWO of the following are valid fields in a CronJob spec? (Select 2)

Select 2 answers
A.restartPolicy
B.concurrencyPolicy
C.completions
D.schedule
E.parallelism
AnswersB, D

Correct: concurrencyPolicy controls how concurrent runs are handled (Allow, Forbid, Replace).

Why this answer

B is correct because `concurrencyPolicy` is a valid field in a CronJob spec that controls how concurrent executions of the job are handled. It can be set to `Allow`, `Forbid`, or `Replace`, which determines whether a new job can start while a previous one is still running.

Exam trap

CNCF often tests the distinction between CronJob spec fields and Job spec fields, trapping candidates who confuse `completions` and `parallelism` (Job-level) with CronJob-level fields like `schedule` and `concurrencyPolicy`.

21
MCQmedium

A Kubernetes pod has two containers: a main application container and a sidecar container running a logging agent. The sidecar container is expected to start before the main container because it needs to initialize a shared log directory. What Kubernetes feature ensures this ordering?

A.Lifecycle hooks
B.Readiness probe on the sidecar
C.Init containers
D.Resource limits
AnswerC

Init containers run sequentially and complete before app containers start.

Why this answer

Init containers run to completion before app containers start, ensuring order.

22
MCQmedium

A developer wants to create a Job that runs exactly 3 pods in parallel. Which field should be set in the Job spec?

A.spec.ttlSecondsAfterFinished: 3
B.spec.backoffLimit: 3
C.spec.parallelism: 3
D.spec.completions: 3
AnswerC

parallelism sets the maximum number of pods running in parallel.

Why this answer

`spec.parallelism` in a Kubernetes Job spec defines the desired number of Pods that should run concurrently. Setting `spec.parallelism: 3` tells the Job controller to run exactly 3 Pods in parallel, meeting the requirement of running 3 pods simultaneously.

Exam trap

The trap here is confusing `spec.parallelism` with `spec.completions` — candidates often think completions controls concurrency, but it actually defines the total number of successful completions needed, not how many run at once.

How to eliminate wrong answers

Option A is wrong because `spec.ttlSecondsAfterFinished` controls how long a completed Job is retained before automatic cleanup, not the number of parallel pods. Option B is wrong because `spec.backoffLimit` sets the number of retries for a failed Pod before marking the Job as failed, not parallelism. Option D is wrong because `spec.completions` defines the total number of successful Pod completions required for the Job to be considered complete, not the number of pods running in parallel.

23
MCQeasy

Which of the following is NOT a valid restart policy for a Pod?

A.OnFailure
B.Always
C.Never
D.UnlessStopped
AnswerD

UnlessStopped is not a valid Kubernetes restart policy.

Why this answer

Kubernetes supports exactly three restart policies for Pods: Always, OnFailure, and Never. 'UnlessStopped' is not a valid restart policy in the Kubernetes API; it is a fabricated option designed to test your knowledge of the allowed values for the `restartPolicy` field in a Pod spec.

Exam trap

The trap here is that candidates may confuse Kubernetes restart policies with Docker's restart policies (which include 'unless-stopped'), assuming they are identical, but Kubernetes only supports the three explicit policies defined in the PodSpec.

How to eliminate wrong answers

Option A is wrong because 'OnFailure' is a valid restart policy that restarts the container only when the container exits with a non-zero exit code. Option B is wrong because 'Always' is the default restart policy and is valid; it automatically restarts the container regardless of the exit code. Option C is wrong because 'Never' is a valid restart policy that never restarts the container after it exits.

24
Multi-Selecthard

Which THREE are valid reasons to use a StatefulSet instead of a Deployment?

Select 3 answers
A.The application requires rolling updates.
B.Each pod requires a stable, unique network identity.
C.Each pod needs its own persistent volume that persists across rescheduling.
D.The application cannot be scaled down.
E.Pods must be terminated in reverse order during shutdown.
AnswersB, C, E

StatefulSets assign stable hostnames based on ordinal index.

Why this answer

StatefulSet assigns each pod a stable, unique network identity (e.g., a hostname like `web-0`, `web-1`) via a headless Service, which is critical for stateful applications like databases that rely on consistent DNS names for clustering and discovery. Deployments create pods with random, ephemeral hostnames, making them unsuitable for workloads requiring predictable network identities.

Exam trap

CNCF often tests the misconception that only StatefulSets support rolling updates, but both controllers do; the trap is confusing a shared feature with a unique StatefulSet capability.

25
Multi-Selecthard

Which THREE statements are true about init containers? (Select 3)

Select 3 answers
A.Init containers support liveness and readiness probes
B.Init containers cannot have resource limits
C.Init containers must complete successfully before any main container starts
D.Init containers run sequentially in the order they are defined
E.If an init container fails, it will restart until it succeeds, regardless of the pod's restartPolicy
AnswersC, D, E

Main containers wait for all init containers to succeed.

Why this answer

Init containers are specialized containers that run to completion before any main application containers in the pod start. They must exit with a zero status (success) for the pod to proceed to the next init container or to start the main containers. This ensures prerequisite setup tasks are completed before the application runs.

Exam trap

The trap here is that candidates confuse init containers with regular containers, assuming they support probes or cannot have resource limits, when in fact init containers are a distinct type with different lifecycle rules and full support for resource constraints.

26
MCQmedium

A user runs: kubectl apply -f job.yaml. The Job spec has backoffLimit: 0. The pod fails immediately. What happens?

A.The Job is retried indefinitely
B.The pod is restarted until it succeeds
C.The Job enters a Failed state
D.A new pod is created automatically
AnswerC

No retries are allowed, so the Job fails.

Why this answer

When `backoffLimit: 0` is set in a Job spec and the pod fails immediately, the Job controller does not retry the pod because the backoff limit is zero. According to Kubernetes Job semantics, the Job is considered failed once the number of failures reaches the `backoffLimit` (0 in this case), so the Job transitions to a Failed state without any further pod creation or retries.

Exam trap

The trap here is that candidates often confuse `backoffLimit` with pod restart policies (e.g., `restartPolicy: OnFailure`), but `backoffLimit` controls the number of retries at the Job level, not pod restarts, and a value of 0 means no retries, not infinite retries.

How to eliminate wrong answers

Option A is wrong because `backoffLimit: 0` means the Job will not retry at all, not indefinitely; indefinite retries would require a negative value or no limit. Option B is wrong because the pod is not restarted; the Job controller does not restart pods—it creates new pods, and with `backoffLimit: 0`, no new pod is created after the first failure. Option D is wrong because a new pod is not created automatically; the Job controller only creates a new pod if the failure count is below the `backoffLimit`, which is 0, so it stops immediately.

27
MCQmedium

You need to debug a running pod that does not have a shell installed. Which kubectl command allows you to start an ephemeral container with a shell?

A.kubectl create pod debug --image=busybox --attach
B.kubectl exec -it <pod> -- /bin/sh
C.kubectl debug <pod> --image=busybox --stdin --tty
D.kubectl run debug --image=busybox --attach
AnswerC

kubectl debug adds an ephemeral container to the pod with the specified image and attaches to it.

Why this answer

`kubectl debug` is specifically designed to add an ephemeral container to a running pod for troubleshooting purposes, even when the original container lacks a shell. The `--image=busybox` flag provides a lightweight image with common debugging tools, and `--stdin --tty` allocates an interactive terminal, allowing you to run commands like `/bin/sh` inside the ephemeral container without modifying the original pod's containers.

Exam trap

The trap here is that candidates often confuse `kubectl exec` (which requires a shell in the existing container) with `kubectl debug` (which adds a new container with a shell), or mistakenly think `kubectl run` or `kubectl create pod` can attach to an existing pod's context.

How to eliminate wrong answers

Option A is wrong because `kubectl create pod debug --image=busybox --attach` creates a new standalone pod, not an ephemeral container attached to an existing running pod, so it cannot debug the target pod's environment. Option B is wrong because `kubectl exec -it <pod> -- /bin/sh` attempts to execute a shell inside the existing container, which fails if the container does not have a shell installed (e.g., a distroless or minimal image). Option D is wrong because `kubectl run debug --image=busybox --attach` launches a new pod in the cluster, not an ephemeral container in the target pod, and thus cannot access the target pod's filesystem, processes, or network namespace.

28
Multi-Selectmedium

Which TWO statements about the .dockerignore file are true?

Select 2 answers
A.It is automatically applied to all docker commands
B.It supports pattern matching similar to .gitignore
C.It can be used to specify which Dockerfile to use
D.It can override the base image from the Dockerfile
E.It can exclude files from being copied into the image by COPY and ADD instructions
AnswersB, E

.dockerignore uses glob patterns similar to .gitignore.

Why this answer

The .dockerignore file supports pattern matching using glob patterns, similar to .gitignore. This allows you to define patterns to exclude files and directories from the Docker build context, preventing them from being sent to the Docker daemon during a build.

Exam trap

The CKAD exam often tests the misconception that .dockerignore affects all Docker commands, when in reality it only applies to the docker build context, not to docker run, docker push, or other commands.

29
Multi-Selectmedium

Which TWO statements about init containers are true? (Select 2)

Select 2 answers
A.Init containers support liveness and readiness probes.
B.Init containers share the same filesystem as the application containers by default.
C.Init containers run sequentially in the order they are defined.
D.Init containers have a restart policy of Always.
E.Init containers must complete successfully before application containers start.
AnswersC, E

Correct: init containers run one after another.

Why this answer

Init containers in a Kubernetes Pod are executed sequentially in the exact order they are defined in the `initContainers` array. Each init container must exit successfully (return code 0) before the next one starts, ensuring a strict dependency chain for initialization tasks.

Exam trap

The trap here is that candidates often confuse init containers with regular containers, assuming they support probes or share filesystems by default, or misremember the restart policy as Always instead of OnFailure.

30
MCQeasy

Which of the following is the correct apiVersion for a CronJob in Kubernetes v1.29?

A.v1
B.cronjob/v1
C.batch/v1beta1
D.batch/v1
AnswerD

Correct: CronJob uses batch/v1 since 1.21.

Why this answer

In Kubernetes v1.29, the correct apiVersion for a CronJob is batch/v1, as CronJob has been stable since v1.21. Option D is correct because batch/v1 is the stable API version for CronJob resources in this release.

Exam trap

The trap here is that candidates may remember older Kubernetes versions where CronJob was still in beta (batch/v1beta1) and fail to update their knowledge to the stable batch/v1, or they might confuse the apiVersion format with a non-existent cronjob/v1.

How to eliminate wrong answers

Option A is wrong because v1 is the apiVersion for core resources like Pod, Service, and ConfigMap, not for CronJob which belongs to the batch API group. Option B is wrong because there is no apiVersion format like cronjob/v1; Kubernetes uses group/version format, and CronJob is part of the batch group. Option C is wrong because batch/v1beta1 was deprecated in v1.21 and removed in v1.25; using it in v1.29 would cause an error.

31
Drag & Dropmedium

Sequence the steps to expose a Kubernetes Service using a NodePort for external access.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

Deployment first, then define NodePort Service, apply, retrieve port, then access externally.

32
MCQmedium

You are tasked with containerizing a Go application. The application compiles into a binary. Which Dockerfile best implements a multi-stage build to produce a minimal image?

A.FROM AS builder\nWORKDIR /app\nCOPY . .\nRUN go build -o myapp\nFROM scratch\nCOPY --from=builder /app/myapp /myapp\nCMD ["/myapp"]
B.FROM ubuntu:latest\nRUN apt-get update && apt-get install -y golang\nCOPY . /app\nWORKDIR /app\nRUN go build -o myapp\nCMD ["./myapp"]
C.FROM golang:1.21 AS builder\nWORKDIR /app\nCOPY . .\nRUN go build -o myapp\nFROM scratch\nCOPY --from=builder /app/myapp /myapp\nCMD ["/myapp"]
D.FROM golang:1.21\nWORKDIR /app\nCOPY . .\nRUN go build -o myapp\nCMD ["./myapp"]
AnswerC

Multi-stage build: first stage compiles, second stage scratch only copies binary. Minimal image.

Why this answer

It uses a multi-stage build: the first stage uses the official `golang:1.21` image to compile the Go binary, and the second stage copies only the compiled binary into a `scratch` (empty) image. This produces a minimal image containing only the binary and no build tools, reducing attack surface and image size.

Exam trap

The CKAD exam often tests the requirement to explicitly name the builder stage (e.g., `AS builder`) and use the correct `COPY --from=builder` syntax, and the trap here is that candidates may pick Option A thinking it is valid multi-stage, overlooking the missing base image in the first `FROM`.

How to eliminate wrong answers

Option A is wrong because it omits the base image name in the `FROM` line (`FROM AS builder` is invalid; a base image like `golang:1.21` must be specified). Option B is wrong because it uses `ubuntu:latest` and installs Go via `apt-get`, which creates a large image with unnecessary OS packages and build dependencies, defeating the purpose of a minimal image. Option D is wrong because it is a single-stage build that includes the entire Go toolchain and source code in the final image, resulting in a bloated image.

33
MCQmedium

You want to expose a container's port 8080 in the Dockerfile. Which instruction should you use?

A.PORT 8080
B.EXPOSE 8080
C.LISTEN 8080
D.PUBLISH 8080
AnswerB

EXPOSE documents the port.

Why this answer

The `EXPOSE` instruction in a Dockerfile informs Docker that the container listens on the specified network port at runtime. It is a metadata declaration that does not actually publish the port; it serves documentation and inter-container communication purposes via Docker networks.

Exam trap

The trap here is that candidates confuse `EXPOSE` with actually publishing the port to the host, thinking it makes the container accessible externally, when in fact it only declares intent and requires `-p` or `--publish` for host access.

How to eliminate wrong answers

Option A is wrong because `PORT` is not a valid Dockerfile instruction; the correct keyword is `EXPOSE`. Option C is wrong because `LISTEN` is not a Dockerfile instruction; it is a directive used in configuration files for services like Apache or Nginx. Option D is wrong because `PUBLISH` is not a Dockerfile instruction; port publishing is done at container runtime using the `-p` or `--publish` flag with `docker run`.

34
MCQhard

You have a Pod that runs a web server and you want to add a sidecar container that exposes a Prometheus metrics endpoint by scraping the web server's logs. Which sidecar pattern does this exemplify?

A.Sidecar pattern (generic)
B.Adapter pattern
C.Ambassador pattern
D.Init container pattern
AnswerB

The adapter pattern modifies or transforms data from the main container to match external interfaces. Here, the sidecar converts logs to metrics.

Why this answer

The adapter pattern is used to adapt the interface of a container to match what another system expects. In this case, the sidecar container scrapes the web server's logs and exposes them as Prometheus metrics, effectively adapting the web server's log output into a format Prometheus can scrape. The other patterns: generic sidecar adds functionality without transforming output; ambassador proxies external connections; init containers run before main containers start.

35
Multi-Selectmedium

Which TWO statements about Init Containers are correct? (Select exactly 2.)

Select 2 answers
A.Init containers run in parallel to reduce startup time
B.Init containers run to completion sequentially before any app containers start
C.Init containers can use a different container image than the app containers
D.If an init container fails, Kubernetes restarts it until it succeeds regardless of restartPolicy
E.Init containers can have liveness and readiness probes
AnswersB, C

They run one after another, each must complete successfully.

Why this answer

Init containers run to completion sequentially before any app containers start (B). They can use a different container image than the app containers (C). Option D is incorrect: if the Pod's restartPolicy is Never, a failing init container causes the Pod to fail and the init container is not restarted; it does not always restart regardless of restartPolicy.

Therefore, only options B and C are correct.

Exam trap

A common trap is thinking that init containers always restart on failure regardless of the Pod's restartPolicy. In fact, with a restartPolicy of Never, the Pod will be marked as failed and the init container will not be restarted.

36
Multi-Selectmedium

Which TWO fields are required in a CronJob manifest? (Select 2)

Select 2 answers
A.startingDeadlineSeconds
B.successfulJobsHistoryLimit
C.schedule
D.concurrencyPolicy
E.jobTemplate
AnswersC, E

The cron schedule is mandatory.

Why this answer

The `schedule` field defines the cron expression that determines when the CronJob runs (e.g., `*/5 * * * *`). This is a mandatory field in a CronJob manifest as per the Kubernetes API specification, without which the controller cannot determine the execution timing.

Exam trap

Candidates often mistakenly think that `concurrencyPolicy` or `startingDeadlineSeconds` are required because they appear frequently in examples, but the only mandatory fields in a CronJob manifest are `schedule` and `jobTemplate`.

37
Multi-Selecthard

Which THREE of the following are valid fields in the '.spec' of a Job manifest?

Select 3 answers
A.replicas
B.parallelism
C.strategy
D.completions
E.backoffLimit
AnswersB, D, E

Specifies the maximum number of pods running concurrently.

Why this answer

'parallelism' is a valid field in the '.spec' of a Job manifest. It controls the maximum number of Pods that can run concurrently for the Job, allowing you to manage parallel execution. This field is part of the Job specification in the Kubernetes API, distinct from Deployments or other controllers.

Exam trap

The trap here is that candidates often confuse Job fields with Deployment fields, assuming 'replicas' or 'strategy' apply to Jobs, when in fact Jobs use 'completions' and 'parallelism' to manage batch execution.

38
Multi-Selecthard

A team wants to deploy a multi-container Pod with a sidecar pattern. Which THREE statements are true about sidecar containers? (Select exactly 3.)

Select 3 answers
A.Sidecar containers are always started before the main container
B.Sidecar containers are used for tasks like log collection, service mesh proxies, or data synchronization
C.Sidecar containers can be updated independently without restarting the main container
D.Sidecar containers run in the same Pod as the main container
E.Sidecar containers share the same network namespace as the main container
AnswersB, D, E

These are common sidecar use cases.

Why this answer

Sidecar containers are auxiliary containers that enhance or extend the functionality of the main application container. Common use cases include log collection (e.g., Fluentd), service mesh proxies (e.g., Envoy), and data synchronization (e.g., rsync or a Git sync sidecar). These tasks support the primary workload without altering its code.

Exam trap

The trap here is that candidates confuse the sidecar pattern with init containers, which do run to completion before main containers start, or assume sidecar containers can be updated independently like separate Deployments.

39
MCQmedium

A user creates a Job with '.spec.completions=5' and '.spec.parallelism=2'. How many pods will run at the same time?

A.5
B.10
C.7
D.2
AnswerD

parallelism=2 means up to 2 pods run concurrently.

Why this answer

`.spec.parallelism=2` directly specifies the maximum number of Pods that can run concurrently for the Job. The `.spec.completions=5` value only sets the total number of successful completions required, not the parallelism. Therefore, at any given time, only 2 Pods will run simultaneously.

Exam trap

The trap here is that candidates often confuse `.spec.completions` with parallelism, assuming the total number of completions equals the number of concurrent Pods, or they mistakenly multiply or add the two values.

How to eliminate wrong answers

Option A is wrong because it confuses `.spec.completions=5` (total required completions) with parallelism; 5 Pods would only run at once if parallelism were set to 5. Option B is wrong because it incorrectly multiplies completions by parallelism (5 × 2 = 10), which is not how Kubernetes schedules Job Pods. Option C is wrong because it adds completions and parallelism (5 + 2 = 7), which has no basis in Job scheduling logic.

40
MCQmedium

You have a multi-stage Dockerfile. You want to copy artifacts from the builder stage to the final stage. Which instruction should you use in the final stage?

A.ADD --from=builder /app/artifact /app/
B.RUN --from=builder cp /app/artifact /app/
C.COPY --from=builder /app/artifact /app/
D.CMD --from=builder /app/artifact /app/
AnswerC

COPY with --from is the standard way to copy files from a previous build stage.

Why this answer

In a multi-stage Docker build, the correct instruction to copy artifacts from a previous stage (named 'builder') to the final stage is COPY --from=builder. The COPY instruction with the --from flag is specifically designed for copying files between stages. ADD also supports --from, but COPY is preferred for copying local files as it is more explicit and predictable.

Therefore, option C is correct.

41
Multi-Selectmedium

Which TWO of the following are valid uses of init containers? (Select 2)

Select 2 answers
A.Running a log collection agent continuously
B.Performing health checks on the main container
C.Setting ownership and permissions on a shared volume before the main container uses it
D.Serving HTTP traffic to the main container
E.Waiting for an external database to be ready before starting the main application
AnswersC, E

Correct: init containers can prepare volumes.

Why this answer

Init containers run to completion before any pod containers start, making them ideal for filesystem setup tasks like changing ownership (chown) or permissions (chmod) on a shared volume. This ensures the main container can access the volume without requiring privileged mode or extra security context settings.

Exam trap

Kubernetes often tests the misconception that init containers can run continuously or serve as sidecars, but the key trap is that init containers must terminate successfully before the main containers start, so only one-time setup tasks are valid.

42
MCQeasy

Which command builds a Docker image from the current directory and tags it as 'myapp:v1'?

A.docker build -t myapp:v1 .
B.docker build -t myapp:v1
C.docker build . -name myapp:v1
D.docker image build --tag myapp:v1
AnswerA

Correct command to build and tag the image.

Why this answer

`docker build -t myapp:v1 .` uses the `-t` flag to tag the image with the name `myapp` and tag `v1`, and the `.` specifies the build context as the current directory. This is the standard syntax for building and tagging a Docker image from a Dockerfile in the current directory.

Exam trap

The trap here is that candidates may forget the mandatory build context argument (the `.`) or confuse the `-t` flag with other flags like `--name`, leading them to choose options that omit the context or use incorrect syntax.

How to eliminate wrong answers

Option B is wrong because it omits the build context (the `.`), which is required for `docker build` to locate the Dockerfile and source files; without it, the command will fail with an error. Option C is wrong because `-name` is not a valid flag for `docker build`; the correct flag is `-t` (or `--tag`), and the syntax `-name myapp:v1` would be interpreted incorrectly. Option D is wrong because `docker image build` is a valid subcommand, but the flag `--tag` requires an argument (e.g., `--tag myapp:v1`), and the build context (`.`) is missing; the command as written would fail due to missing context.

43
Multi-Selectmedium

Which TWO statements are true about Kubernetes Secrets?

Select 2 answers
A.Secret data is base64 encoded in YAML manifests.
B.Secrets cannot be used as environment variables.
C.Secrets are always encrypted at rest by default.
D.Secrets can be mounted as volumes in a Pod.
E.Secrets are limited to 1KB in size.
AnswersA, D

Secret values are base64 encoded, not plaintext.

Why this answer

Kubernetes Secrets store data as base64-encoded strings in YAML manifests. This encoding is not encryption; it simply converts binary or non-printable data into an ASCII string format for safe inclusion in YAML. The base64 encoding is a standard practice for representing arbitrary data in Kubernetes resource definitions.

Exam trap

The trap here is that candidates often confuse base64 encoding with encryption, assuming it provides security, or they mistakenly believe Secrets are encrypted at rest by default, when in fact they are stored in plaintext in etcd unless explicitly configured otherwise.

44
Multi-Selecteasy

Which TWO instructions are commonly used to add files to a Docker image during build? (Select 2)

Select 2 answers
A.COPY
B.ADD
C.ENTRYPOINT
D.RUN
E.CMD
AnswersA, B

Copies files from context into image.

Why this answer

The COPY instruction is used to copy files and directories from the build context into the Docker image filesystem. It is the preferred method for adding local files because it is explicit and does not perform any automatic extraction or URL fetching, making builds more predictable and secure.

Exam trap

The trap here is that candidates may confuse ADD with COPY, thinking ADD is always better because of its extra features, but the CKAD exam expects you to know that COPY is the safer, more predictable choice for adding local files, and ADD should be used only when its specific behaviors (like tar extraction) are needed.

45
Multi-Selecthard

Which THREE of the following are correct about init containers? (Select THREE.)

Select 3 answers
A.They run to completion before the main application containers start
B.They cannot have resource limits set
C.If an init container fails, the pod restarts according to the pod's restartPolicy
D.They run after the main application containers have started
E.They are defined in the spec.initContainers field of a Pod
AnswersA, C, E

Init containers run sequentially and must complete successfully before main containers start.

Why this answer

Init containers are designed to run sequentially to completion before any of the pod's regular application containers start. This ensures that prerequisites, such as database schema migrations or configuration file generation, are completed before the main application begins execution.

Exam trap

The CKAD exam often tests the misconception that init containers cannot have resource limits or that they run after main containers, but the key is that they run before and can have resource constraints just like regular containers.

46
MCQeasy

An init container in a pod runs a database migration script. The init container fails and exits with a non-zero exit code. What will happen to the pod?

A.The main containers will start anyway
B.The pod will enter CrashLoopBackOff
C.The init container will be restarted until it succeeds
D.The pod will be deleted and recreated
AnswerC

Correct: init containers are restarted on failure until they succeed.

Why this answer

Init containers must run successfully (exit 0) before the main containers start. If an init container fails, Kubernetes restarts it (if restartPolicy is Always or OnFailure) until it succeeds. The pod will remain in Init:Error state until the init container succeeds.

47
Multi-Selectmedium

Which TWO of the following are true about .dockerignore files?

Select 2 answers
A.They are optional and have no effect on the build
B.They are placed in the root of the build context
C.They can exclude files from being sent to the Docker daemon during build
D.They can be used to ignore files only for specific build stages
E.They can include files that are in parent directories
AnswersB, C

.dockerignore must be in the root of the build context.

Why this answer

The .dockerignore file must be placed in the root of the build context (the directory specified as the build context in the `docker build` command). The Docker client reads this file to determine which files and directories to exclude from the build context before sending it to the Docker daemon. Without it in the correct location, the ignore rules are not applied.

Exam trap

The trap in this question is that candidates often think .dockerignore is optional and has no effect (option A) or that it can limit to specific build stages (option D). However, in the CKAD exam context, you must know that .dockerignore is a single global file placed at the root of the build context. It reduces the size of the context sent to the Docker daemon, improving build performance.

It cannot be scoped to individual stages; any ignore rules apply to the entire build context.

48
MCQmedium

You run 'kubectl run nginx --image=nginx --restart=Never --dry-run=client -o yaml'. What is the output?

A.A Pod manifest with apiVersion: v1beta1
B.A Pod manifest with apiVersion: v1
C.A Job manifest with apiVersion: batch/v1
D.A Deployment manifest with apiVersion: apps/v1
AnswerB

--restart=Never creates a Pod.

Why this answer

The command `kubectl run nginx --image=nginx --restart=Never --dry-run=client -o yaml` creates a Pod manifest because `--restart=Never` explicitly sets the restart policy to Never, which is a Pod-level field. The `kubectl run` command without `--restart=Never` defaults to creating a Deployment, but with `--restart=Never`, it generates a standalone Pod. The output uses `apiVersion: v1`, which is the correct and stable API version for Pods.

Exam trap

The trap here is that candidates often assume `kubectl run` always creates a Deployment, forgetting that the `--restart` flag changes the resource type, and they may also mistakenly think Pods use a beta API version.

How to eliminate wrong answers

Option A is wrong because Pods use `apiVersion: v1`, not `v1beta1`; `v1beta1` was deprecated and removed in Kubernetes 1.22, and Pods have been stable at v1 since early Kubernetes versions. Option C is wrong because a Job manifest would require `apiVersion: batch/v1` and a different command (e.g., `kubectl create job` or `kubectl run` with `--restart=OnFailure`), but `--restart=Never` forces a Pod, not a Job. Option D is wrong because a Deployment manifest uses `apiVersion: apps/v1` and is generated only when `--restart` is not specified (defaults to `Always`), but `--restart=Never` overrides that default to produce a Pod.

49
MCQeasy

What is the correct apiVersion for a Kubernetes Job in v1.29?

A.batch/v1beta1
B.apps/v1
C.batch/v1
D.v1
AnswerC

batch/v1 is the current stable version.

Why this answer

Kubernetes Jobs are part of the batch API group, and starting from Kubernetes v1.21, the batch/v1 API version is stable and the only supported version for Jobs. In v1.29, batch/v1beta1 has been removed, so batch/v1 is the correct and required apiVersion.

Exam trap

The trap here is that candidates may recall older Kubernetes versions where batch/v1beta1 was still available, or confuse the batch API group with apps/v1 or core v1, leading them to select an incorrect apiVersion for a Job in v1.29.

How to eliminate wrong answers

Option A is wrong because batch/v1beta1 was deprecated in Kubernetes v1.21 and removed in v1.25, so it is not valid for v1.29. Option B is wrong because apps/v1 is used for workloads like Deployments, StatefulSets, and DaemonSets, not for Jobs. Option D is wrong because v1 is the core API group (e.g., Pods, Services) and does not include Job resources.

50
MCQmedium

A pod named 'webapp' is stuck in 'Pending' state. 'kubectl describe pod webapp' shows '0/1 nodes are available: 1 Insufficient memory'. What is the most likely cause?

A.The node has insufficient CPU
B.The container was killed due to out-of-memory
C.The pod's memory request exceeds available node memory
D.The container image does not exist
AnswerC

The pod is pending because no node can satisfy the memory request.

Why this answer

The error message '0/1 nodes are available: 1 Insufficient memory' directly indicates that the pod's memory request exceeds the allocatable memory on the node. The scheduler cannot place the pod because no node has enough unallocated memory to satisfy the pod's memory request. This is a scheduling failure, not a runtime issue.

Exam trap

Kubernetes certification exams often test the distinction between scheduling failures (Pending state) and runtime failures (CrashLoopBackOff, OOMKilled) to see if candidates confuse resource requests with limits or confuse scheduling with execution.

How to eliminate wrong answers

Option A is wrong because the error explicitly mentions 'Insufficient memory', not CPU; insufficient CPU would produce a different message like 'Insufficient cpu'. Option B is wrong because a container killed due to out-of-memory (OOM) would result in a CrashLoopBackOff or OOMKilled state, not a Pending state; Pending means the pod has not yet been scheduled to a node. Option D is wrong because a missing container image would cause an ErrImagePull or ImagePullBackOff event, not a Pending state with a scheduling failure message.

51
Multi-Selecthard

Which THREE options are valid fields in a CronJob spec? (Select 3)

Select 3 answers
A..spec.jobTemplate.spec.template.spec.restartPolicy
B..spec.successfulJobsHistoryLimit
C..spec.schedule
D..spec.concurrencyPolicy
E..spec.jobTemplate.spec.parallelism
AnswersB, C, D

Valid CronJob field to limit history.

Why this answer

`.spec.successfulJobsHistoryLimit` is a valid field in a CronJob spec that controls how many completed jobs are retained for inspection. This field defaults to 3 and helps manage cluster resource usage by limiting the number of successful job records kept in the history.

Exam trap

The trap here is that candidates confuse fields that belong to the CronJob spec with fields that belong to the underlying Job spec, such as `parallelism` or `restartPolicy`, which are valid in a Job but not directly in the CronJob spec's top-level fields.

52
MCQhard

A Pod with an init container and a main container is created. The init container runs a script that takes 10 seconds. The main container's startupProbe has initialDelaySeconds: 5. When does the startupProbe begin?

A.5 seconds after the pod is created
B.10 seconds after the pod is created
C.Immediately after the pod is created
D.After the init container completes, then plus 5 seconds
AnswerD

Init containers must finish before main containers start. Then startupProbe waits initialDelaySeconds.

Why this answer

The startupProbe does not begin until the Pod's containers are actually running. Init containers must complete successfully before any main containers start. Therefore, the startupProbe's initialDelaySeconds of 5 is counted from the moment the main container starts, which is after the init container finishes its 10-second script.

The probe begins 5 seconds after the main container starts, not from Pod creation.

Exam trap

The trap here is that candidates mistakenly think probes start counting from Pod creation time, ignoring the sequential blocking nature of init containers, which must complete before any main container probes are scheduled.

How to eliminate wrong answers

Option A is wrong because it assumes the startupProbe begins 5 seconds after Pod creation, ignoring that init containers must finish first. Option B is wrong because it assumes the probe begins immediately after the init container completes, but the initialDelaySeconds of 5 is still applied after the main container starts. Option C is wrong because probes never begin immediately upon Pod creation; they wait for the container to start and respect any initialDelaySeconds.

53
MCQhard

Consider the following partial Dockerfile: FROM alpine:3.18 AS builder RUN apk add --no-cache curl COPY src /app/src RUN make /app/bin FROM alpine:3.18 COPY --from=builder /app/bin /app/bin CMD ["/app/bin"] What is the primary benefit of this multi-stage build?

A.Faster builds because the builder stage runs in parallel
B.Reduced final image size by excluding build dependencies
C.Automatic caching of the builder stage
D.Improved security by running the builder as a non-root user
AnswerB

Only the final stage is used; build tools from builder are not included.

Why this answer

Multi-stage builds allow copying only the compiled binary from the builder stage, leaving behind build tools and intermediate files, resulting in a smaller final image.

54
Multi-Selecthard

Which THREE statements about Dockerfile CMD and ENTRYPOINT are correct?

Select 3 answers
A.CMD is always ignored if ENTRYPOINT is defined.
B.CMD can be overridden at container runtime by specifying a command after the image name.
C.ENTRYPOINT can be overridden at container runtime using the --entrypoint flag.
D.If both CMD and ENTRYPOINT are specified, CMD provides default arguments to ENTRYPOINT.
E.If neither CMD nor ENTRYPOINT is specified, the container will run but exit immediately.
AnswersB, C, D

Correct: command after image name overrides CMD.

Why this answer

Only three statements are correct. Option A is false because CMD is not ignored when ENTRYPOINT is defined; CMD provides default arguments to ENTRYPOINT. Option B is correct: specifying a command after the image name at runtime overrides CMD.

Option C is correct: ENTRYPOINT can be overridden with `--entrypoint` flag. Option D is correct: CMD provides default arguments to ENTRYPOINT when both are present. Option E is incorrect because if neither CMD nor ENTRYPOINT is specified, the container inherits the base image's default command, which may keep it running (e.g., a shell) or cause it to exit; it does not always run and exit immediately.

Exam trap

A common misconception is that CMD is ignored when ENTRYPOINT is present, but the correct behavior is that CMD becomes default arguments for ENTRYPOINT unless overridden.

55
Matchingmedium

Match each Kubernetes Service type to its behavior.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Exposes service on a cluster-internal IP

Exposes service on each node's IP at a static port

Exposes service externally using a cloud load balancer

Maps service to a DNS name

No cluster IP; used for stateful workloads

Why these pairings

Common Kubernetes service types: ClusterIP (internal), NodePort (static port on nodes), LoadBalancer (cloud LB), ExternalName (DNS alias). Here, correct matches are A and C.

56
Multi-Selectmedium

Which THREE of the following are valid patterns for multi-container pods?

Select 3 answers
A.Init
B.Ambassador
C.Adapter
D.Sidecar
E.Daemon
AnswersB, C, D

Ambassador proxies network traffic to external services.

Why this answer

The Ambassador pattern is a valid multi-container pod pattern where a proxy container handles network communication on behalf of the main application container, abstracting external service connectivity. This pattern is commonly implemented with tools like Envoy or a custom sidecar proxy that manages TLS termination, service discovery, or circuit breaking, allowing the main container to connect to localhost while the ambassador handles remote connections.

Exam trap

The CKAD exam often tests the distinction between pod-level patterns (sidecar, ambassador, adapter) and cluster-level controllers (DaemonSet, Job, ReplicaSet), leading candidates to confuse 'Daemon' as a multi-container pattern when it is actually a controller for running pods across nodes.

57
MCQeasy

Which Dockerfile instruction sets a default command that can be overridden by arguments passed to 'docker run'?

A.ENTRYPOINT
B.EXPOSE
C.CMD
D.RUN
AnswerC

CMD provides defaults that can be overridden.

Why this answer

The CMD instruction in a Dockerfile sets a default command that runs when a container starts. This default can be overridden by providing arguments directly to 'docker run' after the image name, making it the correct choice for a command that is intended to be easily replaced.

Exam trap

The CKAD exam often tests the distinction between CMD and ENTRYPOINT, and the trap here is that candidates confuse CMD (which can be overridden) with ENTRYPOINT (which requires the --entrypoint flag to override), leading them to incorrectly select ENTRYPOINT as the instruction that accepts overrides from 'docker run'.

How to eliminate wrong answers

Option A is wrong because ENTRYPOINT defines a fixed command that cannot be overridden by 'docker run' arguments unless the --entrypoint flag is used; it is designed to set the main executable. Option B is wrong because EXPOSE only documents which ports the container listens on at runtime; it does not execute any command. Option D is wrong because RUN executes commands during the image build process, not at container startup, so it cannot be overridden by 'docker run'.

58
Multi-Selectmedium

Which TWO commands can be used to create a resource from a YAML file?

Select 2 answers
A.kubectl create -f pod.yaml
B.kubectl delete -f pod.yaml
C.kubectl get -f pod.yaml
D.kubectl run -f pod.yaml
E.kubectl apply -f pod.yaml
AnswersA, E

kubectl create -f creates resources from a YAML file.

Why this answer

The `kubectl create -f pod.yaml` command is correct because it instructs Kubernetes to create a resource (in this case, a Pod) defined in the specified YAML file. This is a declarative command that submits the resource manifest to the API server, which validates and stores it in etcd, resulting in the resource being created in the cluster.

Exam trap

The trap here is that candidates may confuse `kubectl run` (which is an imperative command for creating pods or deployments without a file) with a file-based creation command, or they may think `kubectl get` can create resources, when in fact it only retrieves them.

59
MCQmedium

A developer has a Dockerfile that builds a Go application. The final image size is 800MB. Which improvement would MOST reduce the image size?

A.Combine all RUN commands into a single layer
B.Add a .dockerignore file to exclude unnecessary files
C.Use a smaller base image like alpine:3.19
D.Use multi-stage builds with a scratch final stage
AnswerD

Multi-stage builds allow copying only the compiled binary to a minimal final image, removing all build tools.

Why this answer

Multi-stage builds allow copying only the binary from the build stage to a minimal base image, drastically reducing final image size.

60
Multi-Selecthard

Which THREE of the following are correct about the .dockerignore file? (Select 3)

Select 3 answers
A.It supports wildcard patterns to exclude files
B.It is a replacement for .gitignore
C.It can be used to exclude .git directory from the build context
D.It allows comments starting with #
E.It affects the files available in the running container
AnswersA, C, D

Correct: .dockerignore supports glob patterns.

Why this answer

The .dockerignore file supports wildcard patterns (e.g., *, ?, []) to exclude files and directories from the build context, similar to .gitignore. This allows you to define patterns like *.log or temp/* to skip unwanted files during the Docker build process.

Exam trap

The trap here is that candidates often confuse the scope of .dockerignore with runtime container files, thinking it affects the final container, when in reality it only filters the build context sent to the Docker daemon.

61
MCQhard

A developer creates a pod with two containers: a main web server and a sidecar that rotates logs. The sidecar must start before the main container. Which field enforces this startup order?

A.startupProbe
B.lifecycle.preStop
C.initContainers
D.restartPolicy: Always
AnswerC

Init containers run sequentially before main app containers.

Why this answer

`initContainers` run sequentially before the main application containers in a Pod, ensuring the sidecar log-rotation container completes its startup tasks before the web server container starts. This enforces a strict startup order, which is not achievable with regular containers that start concurrently.

Exam trap

The trap here is that candidates confuse init containers with sidecar containers, assuming both can be used for startup ordering, but only init containers guarantee sequential execution before main containers, while sidecar containers run concurrently with the main container.

How to eliminate wrong answers

Option A is wrong because `startupProbe` checks whether a container has started successfully but does not control the order in which containers start; it only delays marking the container as ready. Option B is wrong because `lifecycle.preStop` defines a command executed before a container is terminated, not before it starts, so it cannot enforce startup order. Option D is wrong because `restartPolicy: Always` determines the Pod's restart behavior after container exit, not the startup sequence of containers.

62
Multi-Selectmedium

Which TWO options are valid ways to tag an image when building with Docker?

Select 2 answers
A.docker build --name myapp:1.0 .
B.docker commit myapp:1.0 myrepo/myapp:1.0
C.docker tag myapp:1.0 myrepo/myapp:1.0
D.docker run -t myapp:1.0 myrepo/myapp:1.0
E.docker build -t myapp:1.0 .
AnswersC, E

docker tag creates a new tag for an existing image.

Why this answer

The `docker tag` command explicitly creates a new tag referencing an existing image, allowing you to assign a new name and tag (e.g., `myrepo/myapp:1.0`) to an already built image (e.g., `myapp:1.0`). This is a standard way to prepare an image for pushing to a registry without rebuilding.

Exam trap

The trap here is that candidates confuse `docker tag` with `docker commit` or `docker build` flags, mistakenly thinking `--name` or `docker run` can assign tags, when only `docker tag` and `docker build -t` are valid for tagging images.

Ready to test yourself?

Try a timed practice session using only Application Design and Build questions.