Courseiva

Certified Kubernetes Application Developer CKAD (CKAD) — Questions 451–525

826 questions total · 12pages · All types, answers revealed

Page 6

Page 7 of 12

Page 8
451
MCQmedium

A developer reports that a pod named 'api-pod' is restarted repeatedly. You run 'kubectl get events --field-selector involvedObject.name=api-pod' and see multiple events with reason 'BackOff' and message 'Back-off restarting failed container'. Which probe failure is MOST likely causing this?

A.Resource quota exceeded
B.Readiness probe failure
C.Startup probe failure
D.Liveness probe failure
AnswerD

Liveness probes are the kubelet's health check for container liveness; if a liveness probe fails, the kubelet kills the container and restarts it according to the pod's restartPolicy (default is Always). This is the standard self-healing mechanism designed to recover from deadlocks, unbounded memory leaks, or hung processes. When a developer sees a pod restart, the most common cause is an unhealthy container being restarted by a failed liveness probe. The event for this would be 'Liveness probe failed' with a subsequent container recreate.

Why this answer

The 'BackOff' event with 'Back-off restarting failed container' indicates the kubelet is repeatedly restarting the container because it exited with a non-zero exit code. This behavior is directly caused by a liveness probe failure: when the liveness probe fails, kubelet kills the container and restarts it, leading to a crash loop and the BackOff state. Readiness and startup probes do not trigger restarts—they only control traffic routing or delay other probes.

Exam trap

The trap here is that candidates confuse readiness probe failures (which only affect traffic) with liveness probe failures (which cause restarts), leading them to pick Option B when the BackOff event clearly indicates container restarts.

How to eliminate wrong answers

Option A is wrong because a resource quota exceeded would cause the pod to be in a 'Pending' state or fail to schedule, not produce BackOff events from a running container. Option B is wrong because a readiness probe failure only removes the pod from service endpoints; it does not cause container restarts or BackOff events. Option C is wrong because a startup probe failure prevents liveness and readiness probes from starting, but the container is not restarted—the pod would remain in a 'NotReady' state without triggering BackOff restarts.

452
Multi-Selecteasy

Which TWO are valid fields in a Deployment's rollingUpdate configuration? (Select 2)

Select 2 answers
A.minReadySeconds
B.maxSurge
C.maxUnavailable
D.progressDeadlineSeconds
E.revisionHistoryLimit
AnswersB, C

maxSurge is a valid field within the `rollingUpdate` configuration. It specifies the maximum number of pods (or a percentage of desired pods) that can be created above the desired replica count during an update. This controls how quickly the Deployment can add new pods while maintaining available capacity, and it works together with maxUnavailable to define the update's pace.

Why this answer

In a Deployment's rolling update configuration, the `maxSurge` field defines the maximum number of Pods that can be created above the desired replica count during the update, while `maxUnavailable` defines the maximum number of Pods that can be unavailable during the update. Both are valid fields within the `spec.strategy.rollingUpdate` object in a Kubernetes Deployment.

Exam trap

Kubernetes often tests the distinction between fields that belong to the Deployment's spec versus those that belong specifically to the rollingUpdate subfield, causing candidates to confuse minReadySeconds, progressDeadlineSeconds, or revisionHistoryLimit as part of the rolling update configuration.

453
Multi-Selectmedium

Which THREE of the following are correct statements about Helm?

Select 3 answers
A.Values defined in a 'values.yaml' file can be referenced in templates using '{{ .Values.key }}'.
B.The command 'helm rollback RELEASE REVISION' can undo a release to a previous revision.
C.Helm can be used to manage the lifecycle of a Kubernetes cluster itself.
D.Helm uses a two-way strategic merge patch during upgrades.
E.Helm charts can be stored in a Helm repository and shared.
AnswersA, B, E

values.yaml is the default source of user-supplied configuration for a Helm chart. During chart rendering, the template engine merges values.yaml with any --set or -f overrides, and the resulting object is exposed as .Values in Go templates.

Why this answer

Option A is correct because Helm's templating engine exposes the merged values from values.yaml (and overrides) under the .Values object, so a key defined there is referenced in a template as {{ .Values.key }}. Option B is correct because 'helm rollback RELEASE REVISION' reverts a named release to the specified revision number, restoring the Kubernetes resources to that prior state. Option E is correct because charts are packaged artifacts that can be pushed to and pulled from a Helm repository (an HTTP server hosting an index.yaml plus .tgz chart files), enabling sharing and versioned distribution.

Option C is not correct because Helm manages applications deployed into a Kubernetes cluster, not the cluster's own lifecycle (that is the role of tools like kubeadm, kops, or Cluster API). Option D is not correct because Helm 3 uses a three-way strategic merge patch during upgrades (comparing the old manifest, the new manifest, and the live state), not a two-way merge.

Exam trap

CKAD often tests Helm version differences — candidates incorrectly assume Helm 2's two-way patch or Tiller-based architecture still applies in Helm 3.

454
MCQhard

A pod is stuck in the Pending state. You run 'kubectl describe pod pod-name' and see the event: '0/4 nodes are available: 1 node had taint {node-role.kubernetes.io/control-plane: }, that the pod didn't tolerate, 3 nodes had taint {node.kubernetes.io/disk-pressure: }, that the pod didn't tolerate.' What is the MOST likely cause?

A.The nodes have disk pressure and the pod lacks tolerations
B.The pod has a resource request that exceeds node capacity
C.The nodes have insufficient CPU
D.The nodes have insufficient memory
AnswerA

The `kubectl describe` output would show an event indicating that each node has a taint such as `node.kubernetes.io/disk-pressure`. Because the pod defines no tolerations for that taint, the scheduler filters out those nodes, leaving the pod Pending. Disk pressure is a node condition that the kubelet automatically encodes as a taint, and pods must explicitly tolerate it to be scheduled. This matches the event description exactly, unlike resource-based failures.

Why this answer

The event explicitly states that 1 node had a control-plane taint and 3 nodes had a disk-pressure taint, all of which the pod did not tolerate. The pod remains in Pending state because no node can schedule it until either the taints are removed or the pod includes matching tolerations. This directly matches the condition described in the event.

Exam trap

The trap here is that candidates often confuse taint-based scheduling failures with resource insufficiency (CPU/memory) and select options B, C, or D, even though the event explicitly names taints as the cause.

How to eliminate wrong answers

Option B is wrong because the event does not mention any resource request or capacity issues; it only lists taints as the reason for scheduling failure. Option C is wrong because insufficient CPU would appear as a different event, such as 'Insufficient cpu' in the node conditions, not as a taint-based message. Option D is wrong because insufficient memory would similarly produce an 'Insufficient memory' event, not a taint-related message.

455
MCQhard

A container image requires a seccomp profile that is not the default. The cluster supports the RuntimeDefault seccomp profile. Which Pod securityContext field should be configured to use the RuntimeDefault seccomp profile?

A.seccompProfile: type: RuntimeDefault
B.seccomp: type: RuntimeDefault
C.capabilities: add: [SECCOMP]
D.securityContext: seccomp: type: Unconfined
AnswerA

The correct configuration under a container's securityContext is seccompProfile, and setting its type to RuntimeDefault tells the container runtime to apply its built-in default seccomp profile. This profile restrictively filters syscalls, blocking dangerous ones while allowing normal operation, without requiring you to ship a custom profile. It is the preferred way to enable seccomp in modern Kubernetes because it delegates the policy to the runtime, which is already tuned for safe defaults.

Why this answer

The `seccompProfile` field under the Pod's `securityContext` is the proper way to specify a seccomp profile in Kubernetes. Setting `type: RuntimeDefault` tells the container runtime (e.g., containerd or CRI-O) to use the default seccomp profile provided by the runtime, which is a secure baseline that blocks around 44 system calls while allowing common ones like `read`, `write`, and `exit`. This field was introduced in Kubernetes 1.19 (GA in 1.22) and is the standard approach for configuring seccomp at the Pod or container level.

Exam trap

The trap here is that candidates confuse the old alpha annotation `seccomp.security.alpha.kubernetes.io/pod` (deprecated in 1.19) with the current `seccompProfile` field, or they mistakenly think `capabilities` can set the seccomp profile, when in fact capabilities only grant permission to use seccomp syscalls, not apply a profile.

How to eliminate wrong answers

Option B is wrong because `seccomp` is not a valid field in the Pod `securityContext`; the correct field is `seccompProfile`, and the `type` subfield specifies the profile type (e.g., RuntimeDefault, Localhost, Unconfined). Option C is wrong because `capabilities` with `SECCOMP` is a Linux capability that allows a process to install seccomp filters, but it does not configure the Pod to use the RuntimeDefault profile; it grants the ability to manipulate seccomp, which is a different concept. Option D is wrong because `securityContext` does not have a `seccomp` field; the correct structure is `seccompProfile.type`, and `Unconfined` disables seccomp entirely, which is the opposite of using the RuntimeDefault profile.

456
Multi-Selecteasy

Which TWO of the following are correct about the difference between 'kubectl apply' and 'kubectl create'?

Select 2 answers
A.'kubectl apply' can be used to update existing resources, whereas 'kubectl create' will fail if the resource already exists.
B.'kubectl apply' is declarative, while 'kubectl create' is imperative.
C.'kubectl apply' can only be used to create resources, not update them.
D.'kubectl apply' will delete resources if they are removed from the file.
E.'kubectl create' can only create resources from YAML files, not from stdin.
AnswersA, B

kubectl apply performs a merge-patch on an existing object's desired state, so it can seamlessly update a resource that already exists in the cluster, whereas kubectl create sends POST requests to the API server and receives an AlreadyExists error if the resource is present. This distinction is fundamental: create is for initial provisioning only, while apply is idempotent and safe to run multiple times, making it ideal for declarative configuration management in CI/CD pipelines.

Why this answer

'kubectl apply' can update existing resources, while 'kubectl create' will fail if the resource already exists. Option B is correct: 'kubectl apply' is declarative (manages desired state), whereas 'kubectl create' is imperative (directly creates). Option C is false: 'kubectl apply' can both create and update resources.

Option D is false: 'kubectl apply' does not delete resources removed from the file; it only manages the resources in the file. Option E is false: 'kubectl create' can create resources from stdin, not just YAML files.

457
MCQeasy

What is the purpose of a readiness probe in Kubernetes?

A.To control whether the pod receives traffic from Services
B.To delay the start of other probes for slow-starting containers
C.To monitor resource usage of the container
D.To restart the container if it becomes unhealthy
AnswerA

Readiness probes determine pod readiness; failing pods are removed from Service endpoint slices, so kube-proxy stops forwarding traffic to them. This directly satisfies the stem's requirement to control whether the pod receives traffic from Services, unlike liveness probes which restart containers.

Why this answer

A readiness probe determines whether a container is ready to serve traffic. If the probe fails, the pod is removed from the endpoints of Services, thus it does not receive traffic. Option B describes a startup probe (to delay liveness/readiness probes for slow-starting containers).

Option C describes resource monitoring, not a probe. Option D describes a liveness probe, which restarts the container if unhealthy.

458
MCQeasy

Which command shows the rollout history of a Deployment named 'web'?

A.kubectl rollout status deployment web
B.kubectl get deployment web -o yaml
C.kubectl describe deployment web
D.kubectl rollout history deployment web
AnswerD

This is the dedicated command for viewing rollout history. It lists revisions (e.g., 'REVISION CHANGE-CAUSE'), showing each revision number and the change cause (if annotations are set). It reads the revision history stored in the Deployment's ReplicaSets. This command is specifically designed for that purpose.

Why this answer

`kubectl rollout history deployment web` is the dedicated command to display the revision history of a Deployment, including revision numbers and change-cause annotations. This command directly queries the Deployment's rollout state from the Kubernetes API server, showing each revision's metadata.

Exam trap

The trap here is that candidates confuse `rollout status` (which shows current progress) with `rollout history` (which shows past revisions), or assume `describe` or `get -o yaml` would include historical data when they only show the current state.

How to eliminate wrong answers

Option A is wrong because `kubectl rollout status deployment web` shows the current rollout progress (e.g., waiting for pods to become ready), not the historical list of revisions. Option B is wrong because `kubectl get deployment web -o yaml` outputs the full YAML manifest of the current Deployment spec, not the rollout history. Option C is wrong because `kubectl describe deployment web` provides a summary of the current Deployment state, including events and conditions, but does not list past revisions or rollout history.

459
MCQeasy

Which kubectl command creates a Secret named 'tls-secret' from a TLS certificate file 'cert.pem' and private key file 'key.pem'?

A.kubectl create secret tls tls-secret --certificate=cert.pem --private-key=key.pem
B.kubectl create secret tls tls-secret --cert=cert.pem --key=key.pem
C.kubectl create secret generic tls-secret --from-file=cert.pem --from-file=key.pem
D.kubectl create secret docker-registry tls-secret --cert=cert.pem --key=key.pem
AnswerB

This is the correct command to create a TLS secret: it generates a Secret with the type `kubernetes.io/tls` and stores the contents of `cert.pem` under the `tls.crt` data key and `key.pem` under the `tls.key` data key. The `--cert` and `--key` flags are required and must point to PEM-encoded files. After creation, the secret can be referenced by an Ingress's `tls` section or mounted into a pod for TLS termination.

Why this answer

The `kubectl create secret tls` command is specifically designed to create a TLS secret from a certificate and private key pair. The correct flags are `--cert` for the certificate file and `--key` for the private key file, matching the usage shown in option B.

Exam trap

The trap here is that candidates confuse the `--cert` and `--key` flags with similar flags from other tools (like OpenSSL) or assume `--certificate` is the correct flag, leading them to choose option A, or they mistakenly use `generic` instead of `tls` for TLS secrets, as in option C.

How to eliminate wrong answers

Option A is wrong because it uses `--certificate` and `--private-key` flags, which are not valid for `kubectl create secret tls`; the correct flags are `--cert` and `--key`. Option C is wrong because it uses `kubectl create secret generic`, which creates a generic Opaque secret, not a TLS secret; TLS secrets require the `tls` type to properly encode the certificate and key with the correct keys (`tls.crt` and `tls.key`). Option D is wrong because it uses `kubectl create secret docker-registry`, which is for creating a Docker registry authentication secret, not a TLS secret; it expects `--docker-username`, `--docker-password`, etc., not certificate files.

460
MCQmedium

You deploy a pod with resource requests: cpu: 500m, memory: 256Mi and limits: cpu: 1, memory: 512Mi. The container tries to allocate 600Mi of memory. What happens?

A.The container is OOMKilled because it exceeds the memory limit
B.The container runs normally, but memory usage is throttled
C.The container runs normally because requests are the only constraints
D.The container is evicted from the node
AnswerA

The container is OOMKilled because it exceeds the memory limit. Memory limits are enforced via a cgroup; when the container's memory usage surpasses that limit, the kernel's OOM killer terminates the offending process. This results in the pod's container being marked as OOMKilled with exit code 137, and Kubernetes restarts it according to the restart policy.

Why this answer

The container's memory allocation of 600Mi exceeds its configured memory limit of 512Mi. Kubernetes enforces memory limits using the cgroup memory controller; when a container attempts to allocate more memory than its limit, the kernel's Out-Of-Memory (OOM) killer terminates the container process. This results in the container being OOMKilled, as recorded in the pod status.

Exam trap

CNCF often tests the misconception that memory, like CPU, can be throttled when limits are exceeded, but memory is a non-compressible resource and exceeding its limit always results in an OOM kill, not throttling.

How to eliminate wrong answers

Option B is wrong because memory is not a compressible resource like CPU; exceeding the memory limit triggers an OOM kill, not throttling. Option C is wrong because memory limits are hard constraints enforced by Kubernetes, not just requests; requests are used for scheduling, while limits are enforced at runtime. Option D is wrong because eviction occurs when a node is under memory pressure and the kubelet reclaims resources by terminating pods, not when a single container exceeds its own limit.

461
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

Init containers are always started before any application containers in the pod. Each init container must run to completion successfully before the next one is launched, and if one fails, Kubernetes applies the pod's restartPolicy to determine whether to restart it; only after all init containers succeed does the kubelet start the main app containers.

Why this answer

Option B is correct because Kubernetes executes init containers one at a time, in the order defined in the pod spec, and each must run to completion successfully before the next init container or any app container starts. Option C is correct because each init container is defined with its own image field in the pod spec, so it can use a completely different container image (and different tooling) than the app containers. Option A is wrong because init containers run sequentially, not in parallel, which is the opposite of what the statement claims.

Option D is wrong because if an init container fails, Kubernetes restarts it according to the pod's restartPolicy (Always, OnFailure, or Never), not unconditionally regardless of restartPolicy. Option E is wrong because init containers do not support liveness, readiness, or startup probes; they are only expected to run to completion.

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.

462
MCQmedium

A pod is running with a SecurityContext that sets 'runAsUser: 1000' and 'runAsGroup: 3000'. The container process is running as user 1000. However, the container needs to access a file on a mounted volume that is owned by user 1000 and group 2000. Which SecurityContext setting should be added to ensure the container can read the file?

A.Set fsGroup: 2000 in the pod-level securityContext
B.Set readOnlyRootFilesystem: true
C.Set runAsGroup: 2000
D.Add capability: CAP_DAC_READ_SEARCH
AnswerA

Set fsGroup: 2000 in the pod-level securityContext - This ensures the volume files' group ownership is changed to 2000 and the container process is part of that supplementary group, allowing read access. This is the correct approach.

Why this answer

fsGroup is a pod-level SecurityContext setting that causes Kubernetes to recursively change the group ownership of the volume's files to the specified GID and adds the container's supplemental group list. Setting fsGroup: 2000 makes the mounted volume files group-owned by GID 2000, and the container process running as user 1000 inherits 2000 as a supplemental group, granting read access. This is the canonical fix when a volume's group ownership does not match the container's primary runAsGroup.

Exam trap

CKAD often tests the confusion between runAsGroup (the process's primary GID) and fsGroup (the volume's group ownership), leading candidates to pick runAsGroup when the real issue is on-disk file group ownership.

How to eliminate wrong answers

Option B is wrong because readOnlyRootFilesystem only controls whether the container's root filesystem is writable — it has no effect on volume file ownership or group permissions. Option C is wrong because changing runAsGroup to 2000 alters the process's primary GID but does not change the on-disk group ownership of the volume files, which are owned by group 2000 only if fsGroup applied; without fsGroup the files remain owned by whatever GID the volume plugin assigned. Option D is wrong because CAP_DAC_READ_SEARCH is a Linux capability that bypasses file read permission checks entirely — it is an over-privileged workaround, not the intended Kubernetes mechanism, and it does not address group ownership semantics.

463
MCQeasy

Which command creates a generic Secret with username=admin and password=secret123?

A.kubectl create secret tls mysecret --from-literal=username=admin --from-literal=password=secret123
B.kubectl create secret generic mysecret --from-env-file=username=admin,password=secret123
C.kubectl create secret generic mysecret --from-file=username=admin --from-file=password=secret123
D.kubectl create secret generic mysecret --from-literal=username=admin --from-literal=password=secret123
AnswerD

This is the correct syntax because `kubectl create secret generic` creates an Opaque Secret, and each `--from-literal` flag adds one key-value pair directly from the command line. kubectl automatically Base64-encodes the specified values when storing them in the Secret's `data` field, so `username=admin` and `password=secret123` become the secret's data entries. This approach is ideal for simple credential pairs without needing any local files.

Why this answer

`kubectl create secret generic` with `--from-literal` allows you to specify key-value pairs directly on the command line, creating a generic (opaque) Secret with the literal values `username=admin` and `password=secret123`. This is the standard way to create a generic Secret from literal data.

Exam trap

CNCF often tests the distinction between `--from-literal`, `--from-file`, and `--from-env-file`, and candidates commonly confuse `--from-file` (which expects a file path) with `--from-literal` (which expects a key=value pair).

How to eliminate wrong answers

Option A is wrong because `kubectl create secret tls` creates a TLS Secret, which expects a `--cert` and `--key` file, not literal key-value pairs, and is used for TLS certificates, not generic credentials. Option B is wrong because `--from-env-file` expects a file path (e.g., a `.env` file), not inline key-value pairs; the syntax `--from-env-file=username=admin,password=secret123` is invalid and would cause an error. Option C is wrong because `--from-file` expects a file path (e.g., `--from-file=username=./username.txt`), not literal key-value pairs; using `--from-file=username=admin` would try to read a file named `admin` in the current directory, not set the value to `admin`.

464
MCQeasy

Which kubectl command creates a ConfigMap named 'app-config' from a file 'app.properties'?

A.kubectl create configmap app-config --from-file=app.properties
B.kubectl create configmap app-config --from-literal=app.properties
C.kubectl create configmap app-config --from-env-file=app.properties
D.kubectl create configmap app-config --file=app.properties
AnswerA

The --from-file flag tells kubectl to read the contents of the specified file and create a single data key in the ConfigMap, using the filename (app.properties) as the key and the file's content as the value. This is the correct imperative way to generate a ConfigMap from a file without manually writing a YAML manifest. Because the content becomes the value, any valid file format (properties, JSON, YAML, or plain text) can be stored as an opaque data entry.

Why this answer

`kubectl create configmap app-config --from-file=app.properties` reads the file `app.properties` and creates a ConfigMap with a single key-value pair where the key is the filename (without extension) and the value is the entire file content. This is the standard way to create a ConfigMap from a file in Kubernetes.

Exam trap

The trap here is confusing `--from-file` (which stores the entire file content as a single value) with `--from-env-file` (which parses the file as key-value pairs for environment variables), leading candidates to pick option C when they need to import a properties file as a single blob.

How to eliminate wrong answers

Option B is wrong because `--from-literal` expects a key=value pair directly on the command line, not a filename; using `--from-literal=app.properties` would create a ConfigMap with the literal string 'app.properties' as both the key and value, not the file's content. Option C is wrong because `--from-env-file` is used to import a file containing multiple key=value lines (one per line) as environment variables, not to store the entire file content as a single value. Option D is wrong because `--file` is not a valid flag for the `kubectl create configmap` command; the correct flag is `--from-file`.

465
MCQmedium

You are tasked with deploying a stateless web application on a Kubernetes cluster. The application is containerized and listens on port 8080. You have created a Deployment named 'webapp' with 3 replicas, and a ClusterIP Service named 'webapp-svc' exposing port 80 targeting the application's port 8080. During testing, you notice that some requests to the service return errors while others succeed. You have verified that all Pods are running and ready. The application logs show no errors. What is the most likely cause of the intermittent failures?

A.The ClusterIP Service type does not support load balancing.
B.The Service is not configured with enough endpoints.
C.The Service's targetPort is set incorrectly, causing traffic to be misrouted.
D.The Deployment lacks a readiness probe, causing the Service to route traffic to Pods that are not ready.
AnswerD

Without a readiness probe, kube-proxy considers a Pod 'Ready' as soon as its containers are running, even if the application inside is still initializing, warming up, or temporarily unable to handle traffic. This causes the Service to include such Pods as endpoints, so some requests get routed to a Pod that will sporadically return 5xx errors or drop the connection. A readiness probe solves this by marking the Pod Ready only when it responds successfully to a health check, ensuring the Service’s endpoint list contains only truly available Pods.

Why this answer

The intermittent failures are most likely caused by the absence of a readiness probe in the Deployment. Without a readiness probe, the Service's EndpointSlice controller considers all Pods with a matching label selector as ready endpoints, even if the application inside the container has not finished initializing or is temporarily unable to serve traffic. This results in the ClusterIP Service load-balancing requests to Pods that are not actually ready, causing some requests to fail while others succeed.

Exam trap

CNCF often tests the distinction between 'Pod is Running' (container process started) and 'Pod is Ready' (application is healthy and can serve traffic), trapping candidates who assume that a Running Pod is automatically ready to receive Service traffic.

How to eliminate wrong answers

Option A is wrong because ClusterIP Services do provide internal load balancing via kube-proxy using iptables or IPVS rules, distributing traffic across ready endpoints. Option B is wrong because the Service is configured with a label selector matching the Deployment's Pods, and with 3 replicas all running and ready (as verified), there are exactly 3 endpoints — enough for load balancing. Option C is wrong because the targetPort is set to 8080, which matches the container's listening port, so traffic is correctly routed to the application.

466
MCQeasy

Which of the following is the correct way to create a simple Pod named 'nginx' running the nginx:1.25 image using kubectl?

A.kubectl create nginx --image=nginx:1.25
B.kubectl create pod nginx --image=nginx:1.25
C.kubectl apply nginx --image=nginx:1.25
D.kubectl run nginx --image=nginx:1.25
AnswerD

The correct command is 'kubectl run nginx --image=nginx:1.25'. This is the standard imperative command for creating a single Pod: it generates a Pod object named 'nginx' with the specified container image and submits it to the cluster. 'kubectl run' is specifically designed for this purpose, whereas 'kubectl create' and 'kubectl apply' have different roles.

Why this answer

`kubectl run nginx --image=nginx:1.25` is the imperative command to create a Pod directly without a Deployment. The `run` subcommand is specifically designed to create a Pod (or other resources like Deployments) from an image, and when no resource type is specified, it defaults to creating a Pod. This is the standard CKAD approach for quickly launching a standalone Pod.

Exam trap

The trap here is that candidates confuse `kubectl run` (which creates a Pod or Deployment) with `kubectl create` (which requires a resource type and is often used with files), leading them to incorrectly assume `kubectl create pod` is valid syntax.

How to eliminate wrong answers

Option A is wrong because `kubectl create nginx` is invalid syntax; `kubectl create` requires a resource type (e.g., `deployment`, `pod`) and does not accept a name directly after `create`. Option B is wrong because `kubectl create pod` is not a valid subcommand; `kubectl create` can create a Pod using `kubectl create -f <file>` or `kubectl run`, but `kubectl create pod` is not recognized by kubectl. Option C is wrong because `kubectl apply` is used for declarative management with YAML/JSON files, not for imperative creation with `--image`; `kubectl apply` expects a file or stdin, not inline image arguments.

467
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

schedule is mandatory because it defines the cron expression that tells the CronJob controller when to create a new Job. Without this value, the controller has no time-based trigger, and the Kubernetes API server will reject the manifest as invalid. The expression uses the standard five-field cron format, for example '*/30 * * * *' for every thirty minutes.

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`.

468
MCQeasy

What is the purpose of the '.dockerignore' file?

A.To specify which files to include in the image
B.To ignore files during docker push
C.To exclude files from the build context
D.To list environment variables to ignore
AnswerC

The correct purpose is to exclude files and directories from the build context that the Docker client sends to the Docker daemon, shrinking the upload size and preventing sensitive or irrelevant data from reaching layer builds. Any path listed in .dockerignore is absent from the context, meaning COPY/ADD cannot access those files at all, and changes to them won't invalidate the build cache. This is the intended, documented behavior of the file.

Why this answer

The `.dockerignore` file is used to exclude files and directories from the build context sent to the Docker daemon during a `docker build` operation. By specifying patterns in this file, you prevent unnecessary or sensitive files (like local development artifacts, `.git` directories, or node_modules) from being included, which speeds up the build and reduces the image size. Option C correctly identifies this purpose.

Exam trap

The CKAD exam often tests the distinction between build-time context exclusion (`.dockerignore`) and runtime image content (Dockerfile instructions), so candidates may mistakenly think `.dockerignore` controls what goes into the final image rather than what is sent to the Docker daemon.

How to eliminate wrong answers

Option A is wrong because the `.dockerignore` file excludes files from the build context, not includes them; inclusion is controlled by the Dockerfile's `COPY` or `ADD` instructions. Option B is wrong because `.dockerignore` has no effect on `docker push`, which uploads built image layers to a registry, not files from the build context. Option D is wrong because environment variables are managed via the Dockerfile `ENV` instruction or `--env` flags at runtime, not by `.dockerignore`.

469
MCQmedium

During a rolling update, you want to ensure that a maximum of 2 extra pods are created above the desired replicas. Which field should you set in the Deployment spec?

A.spec.template.spec.containers.resources
B.spec.strategy.rollingUpdate.maxSurge
C.spec.replicas
D.spec.strategy.rollingUpdate.maxUnavailable
AnswerB

`spec.strategy.rollingUpdate.maxSurge` is the correct field because it directly controls the maximum number of pods that can be created above the desired `replicas` value during a rolling update. It allows the Deployment to temporarily overshoot the steady-state replica count to ensure new pods become ready before old ones are terminated, thereby maintaining capacity. For example, `maxSurge: 1` permits one extra pod beyond the desired count, while `maxSurge: 25%` allows a percentage-based overshoot.

Why this answer

B is correct because `spec.strategy.rollingUpdate.maxSurge` controls the maximum number of pods that can be created above the desired replica count during a rolling update. Setting `maxSurge` to 2 (or an absolute value of 2) ensures that at most 2 extra pods are created beyond the desired replicas, allowing the update to proceed with controlled parallelism.

Exam trap

The trap here is that candidates confuse `maxSurge` (extra pods above desired) with `maxUnavailable` (pods below desired), often selecting `maxUnavailable` when the question asks about creating extra pods.

How to eliminate wrong answers

Option A is wrong because `spec.template.spec.containers.resources` defines CPU and memory requests/limits for containers, not rolling update behavior. Option C is wrong because `spec.replicas` sets the desired number of pods but does not control how many extra pods can be created during an update. Option D is wrong because `spec.strategy.rollingUpdate.maxUnavailable` controls the maximum number of pods that can be unavailable during the update, not the number of extra pods above the desired count.

470
Multi-Selectmedium

Which THREE of the following are valid types of Secrets in Kubernetes?

Select 3 answers
A.Opaque
B.kubernetes.io/ssh-auth
C.configmap
D.dockerconfigjson
E.kubernetes.io/tls
AnswersA, B, E

Opaque is the default Kubernetes Secret type when no `type` field is specified, designed for arbitrary key-value pairs such as passwords, API tokens, or configuration fragments. Its data is base64-encoded but not encrypted at rest by default, and no additional validation or controller behavior is attached to it. This makes it the general-purpose fallback for most application secrets, and it is the most commonly used type in practice.

Why this answer

Options A, B, and E are valid Kubernetes Secret types. Opaque is the default type for arbitrary data. kubernetes.io/ssh-auth is used for SSH authentication credentials. kubernetes.io/tls is used for TLS certificates. Options C and D are invalid: configmap is a separate resource, and dockerconfigjson lacks the kubernetes.io/ prefix (the valid type is kubernetes.io/dockerconfigjson).

Exam trap

CNCF often tests the exact naming of built-in Secret types, and the trap here is that candidates may confuse `dockerconfigjson` (missing the `kubernetes.io/` prefix) with the valid `kubernetes.io/dockerconfigjson`, or assume `configmap` is a Secret type when it is a separate resource.

471
MCQmedium

A Pod specification includes: securityContext: { runAsNonRoot: true }. The container image runs as root by default. What will happen when the Pod is created?

A.The Pod will start and immediately be OOMKilled
B.The Pod will run but with a warning
C.The Pod will not start; the kubelet will reject it because the container tries to run as root
D.The Pod will run successfully because K8s overrides the user to non-root
AnswerC

runAsNonRoot instructs the kubelet to verify that the container's effective user is not UID 0 before starting it. When the container image specifies root as its user, the kubelet returns an error and refuses to start the container, leaving the Pod in a failed or Pending state with a container creation failure event. This prevents a root process from ever executing.

Why this answer

When a Pod specifies `runAsNonRoot: true` in its `securityContext`, the kubelet verifies that the container's user ID is non-zero (non-root) before starting the container. If the container image runs as root by default (UID 0), the kubelet will reject the Pod, and it will remain in a `ContainerCreating` or `CrashLoopBackOff` state with an error like 'container has runAsNonRoot and image will run as root'. This is a security enforcement mechanism that prevents privileged execution.

Exam trap

The trap here is that candidates assume Kubernetes will automatically adjust the container user to non-root when `runAsNonRoot` is set, but in reality, Kubernetes only validates the existing user and rejects the Pod if it's root—you must explicitly set `runAsUser` to a non-zero value if the image runs as root.

How to eliminate wrong answers

Option A is wrong because OOMKilled (Out Of Memory Killed) occurs when a container exceeds its memory limit, not due to security context violations; the Pod is rejected before any execution. Option B is wrong because Kubernetes does not issue warnings for security context violations—it enforces them strictly by failing the Pod creation, and the event logs will show an error, not a warning. Option D is wrong because Kubernetes does not automatically override the container's user to non-root; the `runAsNonRoot` flag only validates the user, and if the image runs as root, the Pod is rejected unless you explicitly set `runAsUser` to a non-zero value.

472
Multi-Selectmedium

Which THREE of the following are valid types of probes in Kubernetes? (Select 3)

Select 3 answers
A.Liveness probe
B.Survival probe
C.Readiness probe
D.Health probe
E.Startup probe
AnswersA, C, E

Liveness probe is a standard Kubernetes probe type that checks the health of a running container and restarts it if the probe fails. It helps recover from deadlocks or stuck processes where the container is still running but no longer functioning correctly. When a liveness probe fails, the kubelet kills the container and replaces it according to the pod's restart policy, enabling self-healing applications.

Why this answer

Liveness, Readiness, and Startup probes are all valid probe types in Kubernetes. Liveness probes check if a container is still running and can restart it if needed. Readiness probes determine if a container is ready to serve traffic.

Startup probes delay liveness and readiness checks until the container has started successfully. Options B (Survival) and D (Health) are not valid Kubernetes probe types.

Exam trap

The CKAD exam expects you to know that there are three valid probe types: Liveness, Readiness, and Startup. This question asks for three, so all three correct options must be selected.

473
Multi-Selectmedium

Which TWO items are required for Ingress to work correctly in a Kubernetes cluster?

Select 2 answers
A.At least one rule specifying either host or path
B.An Ingress controller running in the cluster
C.A TLS secret for HTTPS termination
D.A LoadBalancer service for the backend
E.A default backend service
AnswersA, B

At least one rule specifying either a host or path is essential because the Ingress resource is fundamentally a routing table; without a rule, there is no destination for incoming traffic. Each rule defines a mapping from an HTTP host and/or URL path to a backend service, and this mapping is what the controller uses to proxy requests. A bare Ingress with no rules would be inert and could not route anything.

Why this answer

For Ingress to work correctly, the cluster must have a running Ingress controller to process Ingress resources. At least one rule specifying a host or path is required to define routing logic. A TLS secret is optional for HTTPS termination, not mandatory.

Without these two components, the Ingress will not route traffic.

Exam trap

The trap is that TLS is not mandatory; only an Ingress controller and at least one rule are required. Candidates often think TLS is required or that a default backend is necessary, but it is not.

474
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

parallelism specifies the maximum number of Job Pods that can run simultaneously. It does not define the total number of Pods; it only sets the concurrency cap for the Job. For a non-parallel Job, parallelism is implicitly 1, but for a parallel Job, you can set it higher to process multiple work items at once. This field is useful for controlling resource usage and throttling the rate at which work is processed.

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.

475
Drag & Dropmedium

Arrange the steps to create a multi-container Pod with a shared volume.

Drag or tap steps into the slots.

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

Why this order

Define Pod with containers, add shared emptyDir volume, mount in each container, apply, then test.

476
Multi-Selecthard

Which THREE are valid ways to create a ConfigMap?

Select 3 answers
A.kubectl create configmap my-config --from-literal=key=value
B.kubectl create configmap my-config --from-file=app.properties
C.kubectl create configmap my-config --from-env-file=app.env
D.kubectl create configmap my-config --from-file=key=file
E.kubectl apply configmap my-config --from-literal=key=value
AnswersA, B, C

The --from-literal flag creates a single key-value entry directly from the command line, using the exact syntax key=value. It is the simplest way to inject a scalar value, and you can repeat the flag multiple times to add more entries. Each flag must be a valid key-value pair, and the key must follow Kubernetes naming conventions (alphanumeric, '-', '_', '.').

Why this answer

`kubectl create configmap` with `--from-literal` directly creates a ConfigMap with a key-value pair from the command line, which is a standard and valid method. This approach is ideal for simple, single-key configurations without needing external files.

Exam trap

The trap here is that candidates may confuse `kubectl create configmap` with `kubectl apply` or misremember the syntax for `--from-file` with a custom key, leading them to select invalid options like D or E.

477
MCQeasy

Which command creates a TLS secret from an existing certificate and key file?

A.kubectl create secret tls my-tls --cert=cert.pem --key=key.pem
B.kubectl create secret tls my-tls --from-file=cert.pem --from-file=key.pem
C.kubectl create secret generic my-tls --from-file=cert.pem --from-file=key.pem
D.kubectl create secret docker-registry my-tls --docker-server=... --docker-username=... --docker-password=...
AnswerA

This is the correct command because `kubectl create secret tls` is the dedicated subcommand for generating a Kubernetes secret of type `kubernetes.io/tls`. It requires the `--cert` flag to point to the PEM-encoded certificate (usually the full chain) and the `--key` flag to point to the PEM-encoded private key. The resulting secret automatically stores these under the standard data keys `tls.crt` and `tls.key`, which ingress controllers and other TLS consumers expect. Using this exact syntax ensures the secret is properly typed and immediately usable for TLS termination.

Why this answer

The `kubectl create secret tls` command is specifically designed to create a TLS secret from an existing certificate and key file. The `--cert` and `--key` flags directly specify the paths to the PEM-encoded certificate and private key, which Kubernetes then stores as a `kubernetes.io/tls` secret type, automatically base64-encoding the data for secure storage in etcd.

Exam trap

The trap here is that candidates confuse the `--from-file` flag (used for generic secrets) with the `--cert` and `--key` flags (required for TLS secrets), leading them to choose option B or C, which would create a secret of the wrong type or with incorrect key mappings.

How to eliminate wrong answers

Option B is wrong because `kubectl create secret tls` does not support `--from-file` flags; those flags are used with `kubectl create secret generic` or `kubectl create secret docker-registry`, and using them with `tls` would result in a syntax error or create a generic secret instead of a TLS secret. Option C is wrong because `kubectl create secret generic` creates a generic secret (type `Opaque`), not a TLS secret (type `kubernetes.io/tls`), and the `--from-file` flags would store the files as arbitrary keys rather than the required `tls.crt` and `tls.key` entries. Option D is wrong because `kubectl create secret docker-registry` creates a Docker registry authentication secret (type `kubernetes.io/dockercfg`), which is used for pulling images from private registries, not for storing TLS certificates and keys.

478
MCQmedium

You are writing a Deployment manifest for a container that takes up to 60 seconds to become ready. You want to ensure the liveness probe does not interfere during this startup period. What should you configure?

A.Set liveness probe failureThreshold to a high number
B.Set readiness probe initialDelaySeconds to 60
C.Set liveness probe initialDelaySeconds to 60
D.Configure a startup probe with a sufficient failureThreshold and period
AnswerD

This is the correct approach because a startup probe gives the kubelet an explicit phase for container initialization. While the startup probe is failing, liveness and readiness probes are not executed at all; only after the startup probe succeeds do the steady-state probes take over. By configuring a sufficient failureThreshold and periodSeconds, you define the maximum startup window (failureThreshold * periodSeconds) during which the container is allowed to initialize without being killed. This is the canonical pattern for slow-starting containers, as it avoids guessing an exact initialDelaySeconds and automatically adapts to the container's actual startup behavior, then hands off to normal liveness checking.

Why this answer

A startup probe is specifically designed to handle slow-starting containers. It runs during the initial startup phase and, once successful, hands over responsibility to the liveness probe. By setting a sufficient failureThreshold and periodSeconds, you allow the container up to (failureThreshold * periodSeconds) time to start without the liveness probe killing it prematurely.

Exam trap

The trap here is that candidates confuse the purpose of initialDelaySeconds (which only delays the first probe) with the need for a startup probe, which completely suppresses liveness checks until the container is confirmed to have started.

How to eliminate wrong answers

Option A is wrong because increasing the liveness probe failureThreshold only delays the inevitable; the probe still starts immediately and will fail repeatedly, potentially causing restarts or unnecessary resource consumption. Option B is wrong because readiness probe initialDelaySeconds only affects when the container is considered ready to serve traffic; it does not prevent the liveness probe from interfering during startup. Option C is wrong because setting liveness probe initialDelaySeconds to 60 still leaves a gap: if the container takes exactly 60 seconds, the first probe may fail and cause a restart before the container is fully ready.

479
MCQeasy

Which kubectl command shows the rollout history of a Deployment named 'app'?

A.kubectl rollout status deployment app
B.kubectl describe deployment app
C.kubectl rollout history deployment app
D.kubectl get events --field-selector involvedObject.kind=Deployment
AnswerC

The `kubectl rollout history deployment app` command is the dedicated subcommand that displays the rollout history for a Deployment, showing an ordered list of revisions, each with its revision number and, if specified, the change cause from the `kubernetes.io/change-cause` annotation. This output directly reveals how the Deployment has evolved over time, making it the correct choice for viewing rollout history. Additionally, you can use the `--revision` flag to inspect a specific historical revision's detailed configuration.

Why this answer

`kubectl rollout history deployment app` is the specific command designed to display the revision history of a Deployment, including revision numbers and, if configured, the change-cause annotation. This command retrieves the stored rollout history from the Deployment's annotation `deployment.kubernetes.io/revision` and lists all previous ReplicaSets that were created during rollouts.

Exam trap

The trap here is that candidates confuse `rollout status` (which shows current progress) with `rollout history` (which shows past revisions), or they assume `describe` or `get events` would provide the same historical data, but neither command offers the structured revision list that `rollout history` does.

How to eliminate wrong answers

Option A is wrong because `kubectl rollout status deployment app` shows the current status of a rollout (e.g., whether it is progressing or complete), not the historical record of revisions. Option B is wrong because `kubectl describe deployment app` provides the current state and configuration of the Deployment, including its current revision, but does not list the full history of previous rollouts. Option D is wrong because `kubectl get events --field-selector involvedObject.kind=Deployment` retrieves cluster events related to Deployments, which may include rollout events but does not provide a structured, revision-based history of the Deployment's rollouts.

480
Multi-Selecthard

Which THREE of the following are valid fields in a PodSecurityContext (pod-level securityContext)? (Select 3)

Select 3 answers
A.runAsUser
B.fsGroup
C.readOnlyRootFilesystem
D.capabilities
E.seccompProfile
AnswersA, B, E

In the PodSecurityContext, runAsUser specifies the UID that all containers in the pod run with, overriding any image-level USER directive. It is a pod-level field because it belongs to the pod's security context and applies uniformly to every container's primary process. Setting it ensures consistent privilege separation at the pod level.

Why this answer

`runAsUser` is a valid field in a PodSecurityContext that sets the user ID (UID) for all containers in the pod, overriding any container-level `securityContext.runAsUser`. This is defined in the Kubernetes API under `PodSecurityContext` and is commonly used to enforce non-root execution.

Exam trap

CNCF often tests the distinction between pod-level and container-level securityContext fields, and the trap here is that candidates confuse `readOnlyRootFilesystem` and `capabilities` as pod-level fields when they are actually only valid at the container level.

481
Multi-Selectmedium

Which THREE of the following are valid reasons to use a HorizontalPodAutoscaler (HPA) with a Deployment?

Select 3 answers
A.To set a fixed 'targetCPUUtilizationPercentage' that scales down the deployment when exceeded.
B.To scale replicas based on the number of incoming HTTP requests per second.
C.To scale replicas based on custom metrics exposed by the application.
D.To ensure that each pod has at least a certain amount of CPU resources reserved.
E.To automatically scale the number of replicas based on average CPU utilization across pods.
AnswersB, C, E

This is a valid use case for HPA, implemented through custom metrics. By exposing HTTP request counters from the application (e.g., via Prometheus) and registering a custom metrics adapter, HPA can query a metric like `http_requests_per_second` and scale replicas proportionally. The `autoscaling/v2` API allows referencing this custom metric via the `type: Object` or `type: Pods` metric source, making request-driven scaling a common real-world pattern.

Why this answer

Options B, C, and E are valid uses of a HorizontalPodAutoscaler (HPA). HPA can scale based on custom metrics (e.g., HTTP requests per second) via the 'custom' or 'external' metric types, making B and C correct. Option E is correct because HPA can scale based on average CPU utilization using the 'ResourceMetric' type with 'targetAverageUtilization'.

Option A is incorrect: HPA scales up when CPU exceeds the target, not down; also, the deprecated 'targetCPUUtilizationPercentage' field has been replaced by a metrics array. Option D is incorrect: HPA does not enforce resource requests; it only uses them as a basis for metric calculation.

482
MCQmedium

What is the correct schedule expression for a CronJob that runs every 5 minutes?

A.*/5 * * * *
B.* * * * *
C.0 */5 * * *
D.5 * * * *
AnswerA

This is the valid schedule for every 5 minutes: the minute field uses the */5 step syntax, meaning the job fires at minutes 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, and 55. All remaining fields (hour, day of month, month, day of week) are wildcards, so no further restriction is applied. With no seconds field, standard cron has a minute resolution.

Why this answer

The CronJob schedule expression `*/5 * * * *` uses the step syntax (`*/5`) in the minute field, which tells the CronJob to run every 5 minutes. In Kubernetes CronJobs, the schedule follows standard cron syntax: minute, hour, day of month, month, day of week. The asterisk means 'every' and the slash with a number means 'every N units', so `*/5` in the minute field triggers the job at minutes 0, 5, 10, 15, etc., effectively every 5 minutes.

Exam trap

The trap here is that candidates often confuse the step syntax placement: putting `*/5` in the hour field (as in option C) instead of the minute field, mistakenly thinking it means 'every 5 minutes' when it actually means 'every 5 hours'.

How to eliminate wrong answers

Option B is wrong because `* * * * *` means 'every minute' (run at every minute of every hour), not every 5 minutes. Option C is wrong because `0 */5 * * *` means 'at minute 0 of every 5th hour' (i.e., runs at 00:00, 05:00, 10:00, etc.), which is every 5 hours, not every 5 minutes. Option D is wrong because `5 * * * *` means 'at minute 5 of every hour' (i.e., runs once per hour at the 5th minute), not every 5 minutes.

483
MCQeasy

When performing a rolling update of a Deployment with 'maxSurge: 1' and 'maxUnavailable: 0', how many additional pods can be created above the desired replicas during the update?

A.1
B.0
C.Unlimited
D.100%
AnswerA

The correct value is 1 because maxSurge is defined as the number of additional pods that can be created above the desired replica count during a rolling update. Setting maxSurge=1 means that while updating, the deployment may temporarily run one extra pod beyond the desired replicas, ensuring that new pods are available before old ones are terminated, thereby maintaining service availability without exceeding a small, controlled increase in resources.

Why this answer

maxSurge defines the maximum number of pods that can be created above the desired replicas. With maxSurge=1, exactly one extra pod can exist during the update.

484
MCQmedium

You want to use Kustomize to apply a patch to a Deployment in the 'overlays/production' directory. Which command should you run from the kustomization directory?

A.kubectl create -k overlays/production/
B.kubectl apply -k overlays/production/
C.kustomize build overlays/production/ | kubectl apply -f -
D.kubectl apply -f overlays/production/
AnswerB

`kubectl apply -k overlays/production/` is the correct declarative approach because the `-k` flag tells kubectl to treat the directory as a kustomization root, build the resource set defined in `kustomization.yaml`, and send the resulting resources to the API server for apply. It is a single command that natively leverages the kustomize build process inside kubectl, exactly matching the requirement to use kustomize to patch a deployment. This is the canonical way to apply an overlay in modern kubectl without extra tools or piping.

Why this answer

`kubectl apply -k` is the standard command to apply a Kustomize overlay directly from a directory. It instructs kubectl to process the kustomization.yaml file in the specified path, build the final Kubernetes resources with all patches and transformations applied, and then apply them to the cluster. This is the idiomatic way to use Kustomize with kubectl in a production overlay scenario.

Exam trap

The trap here is that candidates confuse `kubectl apply -k` with `kubectl apply -f` or `kustomize build`, not realizing that `-k` is the native Kustomize flag for kubectl and that `-f` does not process kustomization.yaml files.

How to eliminate wrong answers

Option A is wrong because `kubectl create -k` does not exist; the `-k` flag is only supported with `apply`, not `create`. Option C is wrong because while `kustomize build overlays/production/ | kubectl apply -f -` would technically work, it is not the command to run from the kustomization directory — it requires piping and is less efficient than the direct `kubectl apply -k` command, which is the recommended approach in the CKAD exam. Option D is wrong because `kubectl apply -f` expects a raw YAML file, not a Kustomize overlay directory; it would fail to process the kustomization.yaml and apply the patches.

485
MCQmedium

You have a Helm chart for an application. You want to upgrade the release but only if the upgrade does not introduce breaking changes. Which command should you use?

A.helm install --dry-run my-release ./mychart
B.helm upgrade --dry-run my-release ./mychart
C.helm rollback my-release 0
D.helm diff upgrade my-release ./mychart
AnswerB

`helm upgrade --dry-run` is the right choice because it previews the exact changes that an upgrade to `my-release` would apply by rendering the new templates and performing a three-way merge between the last release manifest, the live cluster state, and the desired chart output. It shows a diff of what will be created, updated, or deleted—without actually touching the cluster—so you can catch template errors, missing values, or resource conflicts. Unlike `install`, this command targets the existing release, making it the standard tool for safe upgrade validation.

Why this answer

`helm upgrade --dry-run` simulates the upgrade process and validates the chart against the cluster without actually applying changes. The `--dry-run` flag allows you to detect breaking changes (e.g., missing required values, API deprecations, or incompatible resource definitions) before committing to the upgrade, ensuring the release remains stable.

Exam trap

The trap here is that candidates confuse `--dry-run` with `--diff` or assume `helm diff upgrade` is a built-in command, but Helm's native dry-run is the only guaranteed way to simulate an upgrade without external plugins.

How to eliminate wrong answers

Option A is wrong because `helm install --dry-run` is used to simulate a new installation, not an upgrade; it does not compare the current release state with the new chart, so it cannot detect breaking changes introduced by an upgrade. Option C is wrong because `helm rollback my-release 0` reverts the release to revision 0 (which is invalid; revision numbers start at 1) and performs an actual rollback, not a dry-run check for breaking changes. Option D is wrong because `helm diff upgrade` is not a standard Helm command; the correct command for diffing is `helm diff upgrade` from the `helm-diff` plugin, but it is not built into Helm and requires separate installation, making it unsuitable for a guaranteed built-in solution.

486
MCQmedium

You need to configure a liveness probe for a container that starts a web server on port 8080. The probe should check the '/healthz' endpoint. Which YAML snippet correctly defines this probe?

A.livenessProbe:\n exec:\n command: ["curl", "http://localhost:8080/healthz"]
B.livenessProbe:\n httpGet:\n port: 8080
C.livenessProbe:\n httpGet:\n path: /healthz\n port: 8080
D.livenessProbe:\n tcpSocket:\n port: 8080
AnswerC

This is the correct liveness probe because it declares an httpGet handler that instructs the kubelet to send an HTTP GET request to the container's /healthz endpoint on port 8080. Kubernetes considers the probe successful if the HTTP response status code is in the 200-399 range, so a 400 or 500 response would restart the container. This definition precisely matches the stated requirement of performing a HTTP GET liveness check against that path and port.

Why this answer

It defines an HTTP GET liveness probe that checks the '/healthz' endpoint on port 8080, which is the standard way to verify the health of a web server. The `httpGet` probe sends an HTTP GET request to the specified path and port, and the container is considered healthy if the response status code is between 200 and 399.

Exam trap

The trap here is that candidates often choose a `tcpSocket` probe (option D) thinking it's sufficient for a web server, but the CKAD exam expects you to use an `httpGet` probe with the correct path to validate the application's health endpoint.

How to eliminate wrong answers

Option A is wrong because it uses an `exec` probe with a `curl` command, which is unnecessary when an `httpGet` probe can directly check the HTTP endpoint; also, `curl` may not be installed in the container image, leading to probe failures. Option B is wrong because it omits the `path` field, so the probe defaults to the root path '/' instead of '/healthz', which may not reflect the actual health check endpoint. Option D is wrong because it uses a `tcpSocket` probe, which only checks if the TCP port is open, not whether the web server is serving the correct HTTP response on '/healthz'.

487
MCQhard

A pod with an init container and a main container has 'restartPolicy: Always'. The init container exits with code 0. What happens next?

A.The pod enters CrashLoopBackOff because the init container should not exit
B.The main container starts; if it fails, it will be restarted
C.The pod is considered complete and enters Succeeded phase
D.The init container restarts and runs again
AnswerB

Once all init containers have exited successfully, Kubernetes proceeds to start the main application container. From that point, the pod's restartPolicy (Always, in this case) governs the main container: any failure or non-zero exit triggers a restart by the kubelet, possibly with an exponential backoff. The init container will not be re-executed when the main container restarts, so the pod remains active until the main container exits cleanly.

Why this answer

When an init container exits with code 0, it indicates successful completion. With `restartPolicy: Always`, the pod's main container then starts. If the main container fails, Kubernetes restarts it according to the `restartPolicy`, which is `Always` in this case, so the main container will be restarted indefinitely.

Exam trap

The trap here is that candidates confuse init container behavior with main container behavior, assuming that `restartPolicy: Always` applies to init containers or that a successful init container causes the pod to complete.

How to eliminate wrong answers

Option A is wrong because init containers are designed to run to completion (exit 0) before the main container starts; they are not expected to keep running. Option C is wrong because a pod with `restartPolicy: Always` never enters the Succeeded phase; that phase is reserved for pods with `restartPolicy: OnFailure` or `Never` that complete successfully. Option D is wrong because an init container that exits with code 0 is considered successful and will not restart; only init containers that fail (non-zero exit) are retried.

488
MCQeasy

A developer wants to access a specific pod's port 8080 from their local machine using a temporary connection. Which command should they use?

A.kubectl exec -it pod-name -- sh
B.kubectl port-forward pod/pod-name 8080:8080
C.kubectl proxy
D.kubectl expose pod pod-name --port=8080
AnswerB

kubectl port-forward pod/pod-name 8080:8080 creates a local TCP listener on the specified host port (8080) and tunnels that traffic over the Kubernetes API server to port 8080 of the named pod. This makes the pod's application available at localhost:8080, which is exactly what the developer needs for direct access to a single pod. It is ephemeral and client-side; no Service or Ingress object is created, and the tunnel disappears when the command is terminated.

Why this answer

`kubectl port-forward` creates a temporary, direct tunnel from a local port to a port on a specific pod, allowing the developer to access the pod's port 8080 from their local machine without exposing the pod via a service. This command forwards local port 8080 to the pod's port 8080, enabling debugging or testing with tools like curl or a browser.

Exam trap

The trap here is that candidates often confuse `kubectl port-forward` with `kubectl proxy`, thinking both provide similar access, but `kubectl proxy` only proxies the API server and requires constructing URLs like `/api/v1/namespaces/default/pods/pod-name:8080/proxy/` to reach a pod, which is less direct and more error-prone.

How to eliminate wrong answers

Option A is wrong because `kubectl exec -it pod-name -- sh` opens an interactive shell inside the pod, not a network tunnel to access the pod's port from the local machine. Option C is wrong because `kubectl proxy` creates a proxy to the Kubernetes API server, not a direct tunnel to a specific pod's port, and requires additional URL manipulation to reach pods. Option D is wrong because `kubectl expose pod pod-name --port=8080` creates a Service object that exposes the pod as a network service, which is a persistent, cluster-wide resource, not a temporary connection from the local machine.

489
MCQeasy

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

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

The batch API group manages job-like workloads, and batch/v1 is its stable version, available since Kubernetes 1.21. This version supersedes batch/v1beta1 and is the correct choice for Jobs, supporting features such as ttlSecondsAfterFinished, parallelism, and completions. Always specify batch/v1 for Jobs to ensure compatibility with current and future cluster versions.

Why this answer

In Kubernetes v1.29, the correct apiVersion for a Job is `batch/v1`. The `batch/v1` API version has been stable since Kubernetes 1.21, and Jobs are part of the batch API group. Using `batch/v1` ensures compatibility with the current stable release and provides access to all Job features, including parallelism, completions, and backoff limits.

Exam trap

The trap here is that candidates may confuse the `batch/v1` apiVersion with the older `batch/v1beta1` (which is no longer valid) or incorrectly assume Jobs are part of the core `v1` or `apps/v1` API groups, leading to a wrong answer.

How to eliminate wrong answers

Option B (`apps/v1`) is wrong because `apps/v1` is used for workloads like Deployments, StatefulSets, DaemonSets, and ReplicaSets, not for Jobs. Option C (`v1`) is wrong because `v1` is the core API group (e.g., Pods, Services, ConfigMaps), and Jobs belong to the `batch` API group, not the core group. Option D (`batch/v1beta1`) is wrong because the `batch/v1beta1` version was deprecated in Kubernetes 1.21 and removed in 1.25; using it in v1.29 would result in an API error.

490
Multi-Selecthard

Which THREE of the following are valid fields in a SecurityContext at the container level? (Select three.)

Select 3 answers
A.fsGroup
B.runAsUser
C.readOnlyRootFilesystem
D.capabilities
E.sysctls
AnswersB, C, D

runAsUser is a valid container-level SecurityContext field that specifies the user ID for the container's primary process. When set at the container level, it overrides any runAsUser value defined at the Pod level. This is essential for ensuring containers run as a non-root user, reducing the risk of privilege escalation.

Why this answer

The correct three options are B, C, and D. Option B (runAsUser) sets the user ID for container processes and is valid at container level. Option C (readOnlyRootFilesystem) mounts the root filesystem as read-only.

Option D (capabilities) manages Linux capabilities. Option A (fsGroup) is a Pod-level SecurityContext field, not container-level. Option E (sysctls) is also a Pod-level field and cannot be set at the container level.

Therefore, B, C, and D are the valid container-level fields.

Exam trap

The exam often tests the distinction between Pod-level and container-level SecurityContext fields. A common trap is confusing fsGroup and sysctls, which are only valid at the Pod level, with runAsUser, which is valid at both levels. Candidates may mistakenly select sysctls as container-level.

491
Multi-Selectmedium

Which TWO of the following are valid ways to expose a container port in a pod spec?

Select 2 answers
A.spec.containers[].ports[].hostPort
B.spec.containers[].hostPort
C.spec.containers[].containerPort
D.EXPOSE 8080 in Dockerfile
E.spec.containers[].ports[].containerPort
AnswersA, E

spec.containers[].ports[].hostPort is valid because it explicitly maps a container port to a port on the host node's network interface, enabling external traffic to reach the container via the node's IP without requiring a separate Service object. This field must be nested inside a port entry, alongside containerPort, and comes with operational caveats such as port conflicts and node scheduling constraints.

Why this answer

`spec.containers[].ports[].hostPort` is a valid field in the Pod spec that maps a container port to the host node's network interface. This allows external traffic to reach the container via the host's IP address and specified port, though it is typically used for daemon sets or host-networking scenarios rather than general service exposure.

Exam trap

In the CKAD exam, the trap is that candidates confuse `containerPort` as a top-level field under `containers[]` instead of recognizing it must be nested inside `ports[]`, and they may mistakenly think Dockerfile `EXPOSE` has any effect in Kubernetes.

492
MCQmedium

A NetworkPolicy with the following spec is applied: spec: podSelector: {} policyTypes: - Ingress ingress: - from: - podSelector: matchLabels: role: frontend What does this policy do?

A.Allows all outgoing traffic from pods labeled 'role: frontend'
B.Blocks all incoming traffic to pods labeled 'role: frontend'
C.Allows incoming traffic from pods labeled 'role: frontend' to all pods
D.Has no effect because policyTypes is missing Egress
AnswerC

The policy spec uses an empty podSelector, which selects all pods in the namespace as the destination of traffic. Its ingress rule contains a from podSelector matching any pod labeled 'role: frontend', so those sources are explicitly allowed to initiate connections to every pod selected by the policy. Since no egress rules or policyTypes are set, only inbound traffic is controlled and only from that source label.

Why this answer

This NetworkPolicy selects all pods (empty podSelector `{}`) and defines an ingress rule that only allows incoming traffic from pods with the label `role: frontend`. By default, Kubernetes NetworkPolicies are additive and deny all traffic that is not explicitly allowed, so this policy permits ingress from frontend pods to all pods while blocking all other inbound traffic.

Exam trap

The trap here is that candidates often think an empty `podSelector: {}` has no effect, but in Kubernetes, it selects all pods in the namespace, and combined with the ingress rule, it creates a default-deny for all other traffic.

How to eliminate wrong answers

Option A is wrong because the policy only specifies `Ingress` in `policyTypes` and has no egress rules, so it does not affect outgoing traffic at all. Option B is wrong because the policy does not block all incoming traffic; it explicitly allows incoming traffic from pods labeled `role: frontend`, so only traffic from other sources is blocked. Option D is wrong because `policyTypes` is correctly set to `Ingress`, and the policy has an effect by allowing ingress from frontend pods; missing `Egress` does not invalidate the ingress rules.

493
Multi-Selectmedium

Which TWO statements about Ingress are correct?

Select 2 answers
A.An Ingress resource without an IngressClass will not work
B.Only one Ingress resource can exist per namespace
C.Ingress can handle non-HTTP protocols like TCP
D.Ingress can route traffic based on the requested hostname
E.TLS termination can be configured in the Ingress spec
AnswersD, E

This statement is true because the Ingress spec includes a `host` field in each rule, allowing you to route requests based on the requested domain name. For example, you can direct `app.example.com` to one Service and `admin.example.com` to another, even within the same Ingress resource. This enables host-based virtual hosting, a standard feature of HTTP routing.

Why this answer

An Ingress resource can route traffic based on the requested hostname using the `spec.rules.host` field. This allows multiple hostnames (e.g., `app1.example.com` and `app2.example.com`) to be served by the same Ingress controller, with each hostname directing traffic to different backend services. This host-based routing is a core feature of the Ingress API, as defined in the Kubernetes networking specification.

Exam trap

The trap here is that candidates often confuse Ingress with a general-purpose load balancer and assume it can handle TCP/UDP traffic, but the standard Kubernetes Ingress API only supports HTTP and HTTPS (Layer 7) protocols.

494
MCQhard

You create a Secret with 'kubectl create secret generic db-secret --from-literal=password=myPass'. Later, you mount it as a volume in a pod. When you exec into the container and cat the file, what will you see?

A.password=myPass
B.bXlQYXNz
C.myPass
D.An error because secrets cannot be mounted as volumes
AnswerC

When a Secret volume is mounted, each Secret key becomes a file in the mount path, and its contents are the decoded value exactly as you supplied it. Kubernetes performs this decode from the stored base64 form before writing to the volume, so the raw `myPass` is what an application sees when reading the file. This functionality is a core feature for injecting configuration data into Pods.

Why this answer

When you mount a Secret as a volume, Kubernetes automatically decodes the base64-encoded data and presents the file contents as the original plaintext value. In this case, the Secret stores the literal key-value pair `password=myPass`, and when mounted, the file named `password` contains the decoded value `myPass`.

Exam trap

The trap here is that candidates often confuse the base64-encoded representation stored in the Secret manifest with the decoded content presented when mounted as a volume, leading them to pick Option B.

How to eliminate wrong answers

Option A is wrong because the file content is not the raw `--from-literal` string `password=myPass`; Kubernetes separates the key from the value, so the file name is the key (`password`) and the file content is the value (`myPass`). Option B is wrong because `bXlQYXNz` is the base64 encoding of `myPass`, but when mounted as a volume, Kubernetes automatically decodes the data, so the file contains the plaintext `myPass`, not the encoded string. Option D is wrong because Secrets can absolutely be mounted as volumes; this is a standard and common method for exposing secret data to pods.

495
MCQhard

Given the following partial pod spec: ```yaml securityContext: runAsUser: 1000 runAsGroup: 3000 fsGroup: 2000 ``` Which combination correctly describes the resulting permissions on a mounted volume?

A.Volume owned by user 2000, group 1000; container runs with user 2000 and group 1000
B.Volume owned by user 3000, group 2000; container runs with user 1000 and group 3000
C.Volume owned by user 1000, group 2000; container runs with user 1000 and group 3000
D.Volume owned by user 1000, group 3000; container runs with user 1000 and group 2000
AnswerC

fsGroup 2000 sets the mounted volume's group ownership and permissions, so the volume is owned by group 2000, while runAsGroup 3000 governs the container process's primary group. The volume's user ownership comes from runAsUser 1000. These are distinct axes, which is why the volume group and process group differ.

Why this answer

With `runAsUser: 1000`, the container's primary user ID is set to 1000, and this also makes the volume owned by user 1000. `runAsGroup: 3000` sets the container's primary group ID to 3000. `fsGroup: 2000` changes the group ownership of the mounted volume to group 2000 and adds it as a supplemental group. Thus, the volume is owned by user 1000 and group 2000, and the container runs with UID 1000 and GID 3000.

Exam trap

The trap here is confusing `runAsGroup` (which sets the container's primary GID) with `fsGroup` (which sets the volume's group ownership and adds a supplemental group), leading candidates to incorrectly assign the volume's group to the container's primary group or vice versa.

How to eliminate wrong answers

Option A is wrong because it incorrectly states the volume is owned by user 2000 and group 1000, but `fsGroup` only affects group ownership, not user ownership, and `runAsUser` sets the container's UID to 1000, not 2000. Option B is wrong because it claims the volume is owned by user 3000 and group 2000, but `runAsUser: 1000` sets the container's UID to 1000, not 3000, and `fsGroup: 2000` sets the volume's group to 2000, not the user. Option D is wrong because it states the volume is owned by user 1000 and group 3000, but `fsGroup: 2000` sets the volume's group to 2000, not 3000, and the container's primary group is 3000, not 2000.

496
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

A sidecar container is an auxiliary process that deploys alongside the main container to provide supporting functionality without being the primary workload. Common use cases include collecting and shipping logs (e.g., Fluentd), acting as a service mesh proxy (e.g., Envoy), or synchronizing data volumes between local and remote storage. This pattern encapsulates cross-cutting concerns into a separate, co-located process that shares the Pod's lifecycle.

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.

497
MCQmedium

You need to see the YAML definition of a running pod named 'app' including the current status. Which command should you use?

A.kubectl edit pod app
B.kubectl get pod app -o yaml
C.kubectl get pod app -o yaml --export
D.kubectl get pod app -o json
AnswerB

kubectl get pod app -o yaml is correct because it directly retrieves the live Pod object from the Kubernetes API server and serializes it into YAML, printing the full definition to stdout. This output includes the complete metadata, spec, status, and other fields such as resourceVersion and managedFields, giving you the exact current state of the Pod as known by the cluster. It is the canonical read-only command for viewing a resource's YAML manifest, and unlike editing, it does not require interaction or risk unintended modifications.

Why this answer

`kubectl get pod app -o yaml` retrieves the current live state of the pod from the Kubernetes API server and outputs it in YAML format, including the `status` field with the latest conditions, container states, and other runtime information. This command directly queries the API without modifying the object, making it the standard way to view the full definition and status of a running pod.

Exam trap

The trap here is that candidates may confuse `kubectl get pod -o yaml` with `kubectl describe pod`, which provides a human-readable summary but not the raw YAML definition, or they may mistakenly choose `--export` thinking it cleans up the output, not realizing it removes the very status information the question requires.

How to eliminate wrong answers

Option A is wrong because `kubectl edit pod app` opens the pod's specification in an editor for modification; while it shows the current state, its primary purpose is editing, not just viewing, and it may inadvertently change the object if saved. Option C is wrong because `--export` is a deprecated flag that strips cluster-specific fields like `status`, `nodeName`, and `uid`, which contradicts the requirement to include the current status. Option D is wrong because `-o json` outputs the pod definition in JSON format, not YAML, so it does not satisfy the explicit request for YAML output.

498
MCQeasy

Which Dockerfile instruction is used to specify the base image for a container image?

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

FROM is the only instruction that identifies the base image for a build, either by pulling a tag from a registry (e.g., node:20-alpine) or by referencing a previous build stage by name (e.g., FROM builder AS runtime). This instruction initializes a new build stage and establishes the filesystem, default environment, and runtime libraries that subsequent instructions inherit. Without a valid FROM, Docker will reject the Dockerfile as having no base layer.

Why this answer

The FROM instruction initializes a new build stage and sets the base image for subsequent instructions. It must be the first non-comment instruction in a Dockerfile, pulling a specified image from a registry (e.g., Docker Hub) to provide the filesystem and runtime environment for the container.

Exam trap

The trap here is that candidates confuse RUN (which executes build-time commands) with FROM (which sets the base image), especially when they see RUN apt-get update and assume it defines the environment, but FROM is the mandatory first instruction that establishes the image foundation.

How to eliminate wrong answers

Option A is wrong because COPY is used to copy files from the build context into the container filesystem, not to specify the base image. Option C is wrong because CMD provides default command arguments for the container at runtime, not the base image. Option D is wrong because RUN executes commands in a new layer on top of the current image during build, not to define the base image.

499
MCQeasy

A user creates a Deployment with 3 replicas and a Service of type ClusterIP. The Service selects pods with label 'app: web'. The user wants external clients to access the application via a stable IP address. Which additional resource is required?

A.A second Service of type NodePort
B.A NetworkPolicy
C.An Ingress resource
D.A ConfigMap
AnswerC

An Ingress resource is the correct approach because it manages external HTTP(S) access to services using hostnames and URL paths, and it is backed by an ingress controller that typically provisions a stable external IP or load balancer. This gives clients a single, predictable address to reach the deployment, while also supporting TLS termination and advanced routing rules without creating multiple NodePorts.

Why this answer

A ClusterIP Service is only reachable within the cluster. To expose a Deployment to external clients via a stable IP, an Ingress resource is required because it provides HTTP/HTTPS routing from outside the cluster to the Service, typically using a load balancer or a reverse proxy like NGINX. Ingress also offers a stable external IP (or hostname) and can manage TLS termination, making it the correct choice for external access with a stable endpoint.

Exam trap

CNCF often tests the misconception that a ClusterIP Service alone can be accessed externally, or that a NodePort Service provides a stable IP, when in fact NodePort exposes on ephemeral node IPs and ports, while Ingress provides a stable external endpoint with path-based routing.

How to eliminate wrong answers

Option A is wrong because creating a second NodePort Service would expose the application on a high port on each node, but it does not provide a stable IP address; the node IPs may change, and clients would need to know the specific node and port. Option B is wrong because a NetworkPolicy controls ingress/egress traffic between pods within the cluster, not external access; it cannot expose the application to external clients. Option D is wrong because a ConfigMap is used to store configuration data (e.g., environment variables) for pods, not to expose services externally.

500
MCQeasy

You have a ConfigMap created from an env file. Which command creates the ConfigMap from the file 'app.env' containing key=value pairs?

A.kubectl create configmap app-config --from-file=app.env
B.kubectl create configmap app-config --env-file=app.env
C.kubectl create configmap app-config --from-literal=app.env
D.kubectl create configmap app-config --from-env-file=app.env
AnswerD

--from-env-file=app.env specifically parses a file containing lines in KEY=VALUE format and creates a separate data entry for each line. This is the intended way to import an environment file into a ConfigMap, preserving each variable as its own key-value pair.

Why this answer

`--from-env-file` is the exact flag used to create a ConfigMap from a file containing key=value pairs in env-file format (e.g., `app.env`). This flag parses each line as a key-value pair and stores them as individual data entries in the ConfigMap, unlike `--from-file` which stores the entire file content under a single key.

Exam trap

CNCF often tests the subtle difference between `--from-file` and `--from-env-file`, where candidates mistakenly choose `--from-file` because they think it handles env files generically, but it does not parse key-value pairs.

How to eliminate wrong answers

Option A is wrong because `--from-file=app.env` creates a ConfigMap where the entire file content is stored as a single entry under the key `app.env`, not as separate key-value pairs. Option B is wrong because `--env-file` is not a valid flag for `kubectl create configmap`; it is used with `kubectl run` to inject environment variables from a file into a pod. Option C is wrong because `--from-literal` is used to specify key-value pairs directly on the command line (e.g., `key=value`), not to reference a file, and passing `app.env` as a literal would treat it as a literal string, not a file path.

501
MCQmedium

You need to run a command inside a running pod's container. The container has a shell available. Which command allows you to execute 'ls -la /data' inside the container?

A.kubectl exec pod-name
B.kubectl run pod-name -- ls -la /data
C.kubectl exec pod-name -- ls -la /data
D.kubectl attach pod-name -c container-name
AnswerC

The command `kubectl exec pod-name -- ls -la /data` is correct because it instructs kubectl to run the `ls -la /data` process inside the first container of the existing pod `pod-name`. The `--` separates kubectl's local flags from the remote command to be executed, ensuring that arguments like `-la` are passed to `ls` rather than being interpreted by kubectl. This is the canonical method for executing ad-hoc commands in a running pod's container.

Why this answer

The `kubectl exec` command is designed to execute arbitrary commands inside a running container. The `--` separator tells kubectl that everything after it is the command to run inside the container, not a kubectl flag. Option C correctly uses `kubectl exec pod-name -- ls -la /data` to run `ls -la /data` inside the specified pod's primary container.

Exam trap

The trap here is confusing `kubectl exec` (which runs a command inside an existing container) with `kubectl run` (which creates a new pod), leading candidates to pick Option B, which would create a new pod instead of executing in the running one.

How to eliminate wrong answers

Option A is wrong because `kubectl exec pod-name` without a command after `--` will open an interactive shell (if available) or fail, but it does not execute `ls -la /data`. Option B is wrong because `kubectl run` creates a new pod from an image, not executes a command inside an existing running pod; it would launch a new pod and run `ls -la /data` in that new pod, not the target pod. Option D is wrong because `kubectl attach` attaches to a running container's main process (stdin/stdout/stderr), not to execute a new command; it does not support running `ls -la /data` as a separate process.

502
MCQhard

You have a HorizontalPodAutoscaler (HPA) that targets CPU utilization at 50%. The current average CPU utilization is 80%. The HPA has a stabilization window of 300 seconds and a scale-down policy with a periodSeconds of 60. CPU utilization drops to 40%. How long will it take for the HPA to begin scaling down?

A.After 300 seconds
B.Immediately
C.After 60 seconds
D.After 360 seconds
AnswerA

The correct scale-down timing is 300 seconds because the HorizontalPodAutoscaler always applies the scale-down stabilization window before reducing replicas. This window, defaulting to 300 seconds, prevents the controller from reacting to short-lived CPU drops that might be transient, ensuring that the number of pods is only decreased after the low utilization is consistently observed. Once the stabilization window has passed, the HPA reevaluates the desired replica count and performs the scale-down.

Why this answer

The HPA will begin scaling down after 300 seconds because the stabilization window for scale-down is set to 300 seconds. During this window, the HPA evaluates all recommended replica counts and selects the highest one, effectively delaying any scale-down action until the window expires. Even though CPU dropped to 40% (below the 50% target), the stabilization window prevents premature scale-down.

Exam trap

CKAD often tests the distinction between stabilization windows and scaling policies — candidates confuse periodSeconds (policy evaluation frequency) with the stabilization window (look-back period) and incorrectly add them together.

How to eliminate wrong answers

Option B is wrong because the HPA does not scale down immediately — the stabilization window explicitly delays scale-down decisions to avoid flapping. Option C is wrong because 60 seconds is the periodSeconds of the scale-down policy, which controls how frequently the policy is evaluated, not how long the stabilization window lasts. Option D is wrong because 360 seconds incorrectly adds the stabilization window (300s) and the periodSeconds (60s) — these are separate parameters and do not combine additively for the initial scale-down delay.

503
MCQhard

During a rolling update of a Deployment, you notice that new pods are failing readiness probes. The rollout is stalled. Which command would you use to abort the rollout and revert to the previous revision?

A.kubectl rollout undo deployment <name>
B.kubectl rollout pause deployment <name>
C.kubectl rollout resume deployment <name>
D.kubectl delete deployment <name> --cascade=false
AnswerA

The kubectl rollout undo deployment <name> command reverts a Deployment to its previous revision by scaling down the current ReplicaSet and scaling up the prior ReplicaSet according to the stored rollout history. This updates the pod template to the old spec, effectively reversing the changes made by the rolling update. Use --to-revision to target a specific revision, otherwise it selects the last available revision.

Why this answer

'kubectl rollout undo deployment <name>' reverts the rollout to the previous revision. Option A is correct.

504
MCQmedium

You have an HPA that scales a Deployment based on CPU utilization. You want to prevent the Deployment from scaling down for at least 5 minutes. Which HPA behavior field should you configure?

A.behavior.scaleUp.policies[0].periodSeconds
B.behavior.scaleDown.stabilizationWindowSeconds
C.behavior.scaleUp.stabilizationWindowSeconds
D.behavior.scaleDown.policies[0].periodSeconds
AnswerB

Setting behavior.scaleDown.stabilizationWindowSeconds configures the HPA to remember the desired replica counts from the last N seconds and, when scaling down, to use the maximum of those historical values instead of the newest recommendation. This creates the cooldown effect: after CPU utilization falls, the controller will not immediately shrink to the new lower desired count; it will only step down once the higher value ages out of the window. This prevents rapid, oscillating scale-downs during transient load dips and is exactly the field needed to avoid premature replica reduction.

Why this answer

To prevent scaling down, you can set a stabilization window on the scaleDown policy. Option B correctly sets a stabilizationWindowSeconds in the scaleDown behavior.

505
Multi-Selecthard

Which THREE of the following are capabilities that can be added to a container's securityContext?

Select 3 answers
A.RuntimeDefault
B.CAP_SYS_ADMIN
C.NET_ADMIN
D.CHOWN
E.SYS_TIME
AnswersC, D, E

NET_ADMIN is the Kubernetes name for the Linux capability CAP_NET_ADMIN, which permits operations such as configuring network interfaces, modifying routing tables, and managing firewall rules. It is a legitimate capability that can be added to a container's security context, making it one of the three correct answers.

Why this answer

(NET_ADMIN) is correct because it is a Linux capability that can be added to a container's securityContext under the `capabilities.add` field. This capability allows the container to perform network administration tasks such as interface configuration, firewall management, and routing table manipulation, which are common in network-focused pods.

Exam trap

The trap here is that candidates often confuse seccomp profiles (like RuntimeDefault) with Linux capabilities, or they assume that all capability names must be prefixed with 'CAP_' in the YAML (e.g., writing 'CAP_NET_ADMIN' instead of 'NET_ADMIN'), leading them to select incorrect options.

506
MCQhard

You have a pod that runs a single container with the following resource limits: memory: 256Mi, cpu: 500m. The container is consistently using 300Mi of memory and 300m of CPU. The pod is running but you want to avoid OOMKilled. Which change should you make?

A.Increase memory limit to 512Mi
B.Set memory request to 128Mi and keep limit at 256Mi
C.Decrease memory limit to 128Mi
D.Increase CPU limit to 1000m
AnswerA

The container is being OOMKilled because its memory usage exceeds the current limit, triggering the kernel OOM killer. Raising the limit to 512Mi provides sufficient headroom for the container's observed usage, allowing the process to continue running. This is only safe if the node has enough allocatable memory to accommodate the new limit.

Why this answer

The container is consistently using 300Mi of memory, which exceeds the current memory limit of 256Mi. When a container exceeds its memory limit, the kernel's OOM killer terminates the process (OOMKilled). Increasing the limit to 512Mi provides headroom above the actual usage, preventing OOM kills while allowing the container to continue running.

Exam trap

The trap here is that candidates often confuse CPU and memory resource management, thinking that increasing CPU limits can solve memory-related OOM kills, or that requests alone (without adjusting limits) can prevent termination.

How to eliminate wrong answers

Option B is wrong because setting a memory request of 128Mi does not prevent OOMKilled; the limit remains at 256Mi, which is still below the actual 300Mi usage, so the container will still be killed when it exceeds the limit. Option C is wrong because decreasing the memory limit to 128Mi would make the problem worse, as the container would exceed the limit even more frequently, leading to immediate OOMKilled. Option D is wrong because increasing the CPU limit to 1000m does not address the memory exhaustion issue; CPU limits affect CPU throttling, not memory, and OOMKilled is triggered by memory limit violations, not CPU.

507
MCQmedium

A NetworkPolicy named 'deny-all' is applied in a namespace. Which YAML snippet correctly implements a default-deny-all ingress policy?

A.spec: podSelector: {} policyTypes: - Ingress
B.spec: podSelector: {} ingress: - from: []
C.spec: podSelector: matchLabels: {} ingress: - from: []
D.spec: podSelector: matchLabels: {} policyTypes: - Ingress
AnswerA

Empty podSelector targets all pods; no ingress rules means deny all ingress.

Why this answer

A NetworkPolicy with an empty `podSelector: {}` selects all pods in the namespace, and specifying `policyTypes: [Ingress]` without any `ingress` rules creates a default-deny-all ingress policy, blocking all incoming traffic. Options B and C include `ingress` rules (with empty `from`), which is not the standard approach for a strict deny-all; the canonical method is to omit the `ingress` field entirely when using `policyTypes: [Ingress]`.

Exam trap

The trap is that candidates often think specifying an empty `ingress: []` or `from: []` allows all traffic, but in Kubernetes NetworkPolicy, both an empty `ingress` list and an omitted `ingress` field result in denying all ingress traffic. However, the standard default-deny pattern is to omit the `ingress` field entirely while including `policyTypes: [Ingress]`.

How to eliminate wrong answers

Option B is wrong because it includes an `ingress` rule with an empty `from: []`, which actually allows all ingress traffic (an empty `from` matches nothing, but the presence of an `ingress` field with a rule means traffic is allowed by default). Option C is wrong because `matchLabels: {}` is equivalent to `podSelector: {}` but the inclusion of `ingress: [from: []]` again allows all ingress traffic, not deny-all. Option D is wrong because `matchLabels: {}` is valid, but it lacks the `ingress` field entirely; however, the `policyTypes: [Ingress]` alone without an `ingress` rule does deny all ingress, but the use of `matchLabels: {}` is unnecessary and could be misleading—the correct minimal form uses `podSelector: {}` without `matchLabels`.

508
MCQmedium

What is the purpose of the 'maxUnavailable' field in a Deployment's rolling update configuration?

A.The maximum number of Pods that can be created above the desired replicas.
B.The maximum number of Pods that can be unavailable during the update.
C.The maximum time allowed for the update to complete.
D.The maximum number of Pods to be terminated simultaneously.
AnswerB

This is the correct definition. The maxUnavailable field in a Deployment's rolling update strategy sets the maximum number of Pods that can be unavailable relative to the desired replicas during the update process. It guarantees that a sufficient number of Pods remain running to serve traffic, with the default of 25% ensuring at least 75% availability.

Why this answer

The 'maxUnavailable' field in a Deployment's rolling update configuration specifies the maximum number of Pods that can be unavailable during the update process, relative to the desired replica count. This ensures that a controlled number of Pods are taken down at a time, maintaining application availability while the update progresses. It is defined as either an absolute number or a percentage of the desired replicas, and it works in conjunction with 'maxSurge' to control the update pace.

Exam trap

The trap here is that candidates often confuse 'maxUnavailable' with 'maxSurge' or assume it controls the termination rate, but the CKAD exam tests the precise definition that it limits the number of Pods that can be in an unavailable state during the update, not the number created above desired or the termination speed.

How to eliminate wrong answers

Option A is wrong because it describes the 'maxSurge' field, which controls the maximum number of Pods that can be created above the desired replicas, not 'maxUnavailable'. Option C is wrong because there is no 'maxUnavailable' field for time limits; Kubernetes uses 'progressDeadlineSeconds' for update timeout, not 'maxUnavailable'. Option D is wrong because while 'maxUnavailable' indirectly limits simultaneous terminations, it specifically caps the number of unavailable Pods (including those being terminated), not the number of Pods terminated simultaneously—Kubernetes handles termination in a rolling fashion based on availability constraints.

509
MCQhard

An Ingress resource specifies TLS termination using a secret. The secret must contain which keys?

A.username and password
B.cert.pem and key.pem
C.ca.crt and tls.crt
D.tls.crt and tls.key
AnswerD

This is the correct answer because a Kubernetes secret of type `kubernetes.io/tls` conventionally uses exactly these two data keys: `tls.crt` holds the PEM-encoded server certificate (and optionally an intermediate chain), and `tls.key` holds the PEM-encoded private key. When an Ingress resource specifies a TLS block with `secretName`, the controller loads these keys to terminate HTTPS for the configured host. The presence of both correctly named keys, along with a matched certificate/key pair, enables a valid TLS termination setup.

Why this answer

Kubernetes Ingress resources require TLS termination secrets to contain exactly two keys: `tls.crt` (the TLS certificate) and `tls.key` (the private key). The Ingress controller reads these specific key names from the Secret's `data` or `stringData` field to configure HTTPS termination, as defined by the Kubernetes API specification.

Exam trap

The trap here is that candidates confuse common file extensions (`.pem`, `.crt`, `.key`) with the exact key names required by Kubernetes (`tls.crt`, `tls.key`), leading them to pick option B or C instead of D.

How to eliminate wrong answers

Option A is wrong because `username` and `password` are generic authentication credentials, not TLS certificate components; they are used for basic auth or registry secrets, not Ingress TLS. Option B is wrong because `cert.pem` and `key.pem` are common file names but not the required key names in a Kubernetes Secret for Ingress TLS; the controller expects `tls.crt` and `tls.key` exactly. Option C is wrong because `ca.crt` is an optional CA certificate for client-side verification, not a required key for server-side TLS termination, and `tls.crt` alone is insufficient without `tls.key`.

510
Multi-Selecthard

You have a Deployment 'web-app' with 4 replicas. You want to perform a rolling update such that during the update, at most 2 pods can be unavailable and at most 5 pods can be above the desired replica count. Which TWO of the following strategy configurations achieve this?

Select 2 answers
A.maxSurge: 3, maxUnavailable: 3
B.maxSurge: 5, maxUnavailable: 0
C.maxSurge: 5, maxUnavailable: 2
D.maxSurge: '125%', maxUnavailable: '50%'
E.maxSurge: 1, maxUnavailable: 2
AnswersC, D

Correct because maxSurge: 5 allows up to 5 extra pods, and maxUnavailable: 2 allows up to 2 unavailable, matching the requirement.

Why this answer

MaxSurge: 5 and maxUnavailable: 2 means during the rolling update, up to 2 pods can be unavailable (below the desired 4) and up to 5 extra pods can be created above the desired count, allowing a total of 9 pods at peak. This satisfies the requirement that at most 2 pods are unavailable and at most 5 pods are above the desired replica count. Option D is correct because 125% of 4 equals 5, and 50% of 4 equals 2, so the effective limits are the same as option C.

Option B is incorrect because maxUnavailable: 0 prevents any pod from becoming unavailable during the update, making it impossible to delete old pods without violating the constraint. A rolling update requires some pods to become temporarily unavailable when they are terminated; with maxUnavailable=0, the update cannot proceed because no pod can be terminated. Thus, the configuration does not achieve a successful rolling update.

Options A and E are incorrect because they allow more than 2 pods unavailable (A: maxUnavailable=3) or allow only 1 extra pod (E: maxSurge=1), not the required 5.

Exam trap

The CKAD exam often tests the distinction between absolute and percentage values for maxSurge and maxUnavailable, and the trap here is that candidates may incorrectly assume percentages are always rounded down or that both values must be integers, missing that '125%' and '50%' produce the same effective limits as 5 and 2 for a 4-replica deployment.

511
MCQhard

You want to restrict a Pod to only run with a seccomp profile of 'RuntimeDefault'. Which SecurityContext field should you set?

A.appArmorProfile
B.capabilities
C.seLinuxOptions
D.seccompProfile
AnswerD

This is the correct field in the `securityContext` (either at pod or container level) to specify a seccomp profile that restricts system calls. By setting `type: RuntimeDefault`, you tell the container runtime (e.g., containerd, CRI-O) to use its default seccomp profile, which blocks a set of dangerous or unused syscalls. For custom filters, you can point to a `Localhost` profile using the `localhostProfile` field and a node's profile directory. This directly satisfies the requirement of running with a seccomp profile.

Why this answer

The `seccompProfile` field in a Pod's SecurityContext allows you to specify a seccomp profile to restrict system calls. Setting it to `RuntimeDefault` applies the container runtime's default seccomp profile, which blocks a set of dangerous syscalls while allowing normal operation. This is the correct field to enforce a seccomp profile of 'RuntimeDefault'.

Exam trap

The trap here is that candidates confuse seccomp with other security mechanisms like AppArmor or SELinux, or think that `capabilities` can restrict syscalls, when in fact seccomp is the only field that directly controls syscall filtering.

How to eliminate wrong answers

Option A is wrong because `appArmorProfile` is used to set AppArmor profiles, not seccomp profiles; AppArmor is a separate Linux Security Module (LSM) that controls file access and capabilities. Option B is wrong because `capabilities` adds or drops Linux capabilities (e.g., CAP_NET_ADMIN), which are privileges, not syscall filters. Option C is wrong because `seLinuxOptions` configures SELinux labels for process and file security contexts, which is another LSM unrelated to seccomp.

512
MCQmedium

A pod named 'db-pod' is running but not responding as expected. You want to check its logs from the previous instantiation (after a crash). Which command should you use?

A.kubectl exec db-pod -- cat /var/log/app.log
B.kubectl logs -f db-pod
C.kubectl describe pod db-pod
D.kubectl logs db-pod --previous
AnswerD

The --previous flag instructs kubectl to fetch the log file from the last container instance that terminated, which is exactly the data you need when the current container was restarted due to a crash. This works even if the current container is now running, as long as a previous instance exists; if the pod has multiple containers, you must add -c <container-name> to target the right one.

Why this answer

The `--previous` flag in `kubectl logs` retrieves logs from the previous instantiation of a container in a pod that has crashed or restarted. This allows you to inspect the logs from the terminated container before the current running instance, which is essential for debugging why the pod is not responding as expected after a crash.

Exam trap

The trap here is that candidates often confuse `kubectl logs` with `kubectl describe` or assume that `kubectl exec` into the running container can access logs from a previous crash, but the `--previous` flag is the only way to retrieve logs from a terminated container instance.

How to eliminate wrong answers

Option A is wrong because `kubectl exec db-pod -- cat /var/log/app.log` attempts to read a log file from the current running container, which may not exist or may not contain logs from the previous crashed instance; it also assumes the application writes logs to a specific file path, which is not the standard Kubernetes logging mechanism. Option B is wrong because `kubectl logs -f db-pod` streams the logs of the currently running container in real-time, but it does not show logs from the previous instantiation after a crash. Option C is wrong because `kubectl describe pod db-pod` provides metadata, events, and status of the pod, but it does not retrieve container logs, let alone logs from a previous instantiation.

513
MCQhard

You need to create a Pod that mounts a Secret named 'mysecret' as an environment variable 'SECRET_DATA'. The secret has a key 'password'. Which YAML snippet correctly achieves this?

A.env: - name: SECRET_DATA valueFrom: configMapKeyRef: name: mysecret key: password
B.env: - name: SECRET_DATA valueFrom: secretKeyRef: name: mysecret key: password
C.env: - name: SECRET_DATA valueFrom: secretKeyRef: name: password key: mysecret
D.volumeMounts: - name: secret-volume mountPath: /etc/secret volumes: - name: secret-volume secret: secretName: mysecret items: - key: password path: secret.txt
AnswerB

This is the correct approach. secretKeyRef directly references the Secret object by name ('mysecret') and extracts the specific key ('password') from that Secret's data. When this env var is defined, Kubernetes fetches the decoded value of the 'password' key and injects it into the container's SECRET_DATA environment variable, fulfilling the requirement to mount the secret as an environment variable.

Why this answer

It uses the `secretKeyRef` field under `valueFrom` to reference a specific key from a Secret named 'mysecret' and inject its value into the environment variable `SECRET_DATA`. This is the standard Kubernetes syntax for exposing a Secret's key-value pair as an environment variable.

Exam trap

The trap here is that candidates often confuse `configMapKeyRef` with `secretKeyRef` or swap the `name` and `key` fields, leading them to pick options that either reference the wrong resource type or misorder the required fields.

How to eliminate wrong answers

Option A is wrong because it uses `configMapKeyRef` instead of `secretKeyRef`; ConfigMaps are for non-sensitive data, while Secrets require `secretKeyRef`. Option C is wrong because it swaps the `name` and `key` fields: `name` should be the Secret's name ('mysecret'), and `key` should be the key within that Secret ('password'). Option D is wrong because it mounts the Secret as a file via a volume, not as an environment variable, which does not meet the requirement to expose the value as `SECRET_DATA`.

514
Multi-Selecteasy

Which TWO of the following are valid types for a Kubernetes Secret? (Choose two.)

Select 2 answers
A.kubernetes.io/tls
B.kubernetes.io/basic-auth
C.kubernetes.io/configmap
D.kubernetes.io/tls-key
E.kubernetes.io/ssh-key
AnswersA, B

The `kubernetes.io/tls` Secret type is a built-in type designed specifically to store a TLS certificate and its associated private key. The data keys must be named exactly `tls.crt` for the certificate and `tls.key` for the private key; when mounted or referenced by an Ingress, the API server uses these keys to configure HTTPS termination. It is the standard type for any TLS secret, and its structure is enforced by Kubernetes controllers for Ingress and other TLS consumers.

Why this answer

Option A, kubernetes.io/tls, is a valid built-in Secret type used to store a TLS certificate and its associated private key, typically consumed by Ingress controllers for HTTPS termination. Option B, kubernetes.io/basic-auth, is also a valid built-in Secret type designed to hold a username and password for basic authentication, with the required keys being 'username' and 'password'. Option C, kubernetes.io/configmap, is not a valid Secret type because ConfigMaps are a separate Kubernetes API object with their own kind and are not represented as a Secret type.

Option D, kubernetes.io/tls-key, is not a recognized built-in Secret type; the TLS private key is instead stored as the 'tls.key' data key within a kubernetes.io/tls Secret. Option E, kubernetes.io/ssh-key, is not a built-in Secret type in Kubernetes, as SSH keys would typically be stored using the generic Opaque type or a custom type.

Exam trap

The trick is that candidates may confuse similar-sounding types. For example, kubernetes.io/tls-key is not a valid type; the correct one is kubernetes.io/tls. Similarly, kubernetes.io/ssh-auth is valid but kubernetes.io/ssh-key is not.

Knowing the exact built-in types is essential.

515
MCQeasy

Which kubectl command sets the number of replicas for a deployment named 'nginx' to 5?

A.kubectl update deployment nginx --replicas=5
B.kubectl scale deployment nginx --replicas=5
C.kubectl set scale deployment nginx --replicas=5
D.kubectl resize deployment nginx --replicas=5
AnswerB

kubectl scale deployment nginx --replicas=5 is the correct command because the scale subcommand directly adjusts the desired replica count for a Deployment, updating spec.replicas in the live object. It also accepts optional flags like --current-replicas to perform optimistic concurrency checks and --timeout to wait for the scale operation to complete. This is the standard imperative way to resize a Deployment's pod count in Kubernetes.

Why this answer

kubectl scale is the correct command to change the replica count of a deployment.

516
Multi-Selectmedium

Which TWO actions can help prevent a container from being compromised if an attacker gains access? (Select 2)

Select 2 answers
A.Setting securityContext.readOnlyRootFilesystem: true
B.Setting automountServiceAccountToken: true
C.Setting securityContext.capabilities.drop: ["ALL"]
D.Setting securityContext.allowPrivilegeEscalation: true
E.Setting securityContext.runAsUser: 0
AnswersA, C

Setting readOnlyRootFilesystem to true mounts the container's root filesystem as read-only, so even a compromised process cannot modify binaries, libraries, or write new files to the container layer. Any legitimate writes must go to explicitly mounted writable volumes, which sharply limits the blast radius of an attack. This is a strong defense-in-depth control that complements other securityContext settings.

Why this answer

Setting `securityContext.readOnlyRootFilesystem: true` makes the container's root filesystem read-only, preventing an attacker who gains access from modifying system binaries, libraries, or configuration files. This is a key defense-in-depth measure that limits the impact of a compromise by restricting write access to only explicitly mounted volumes.

Exam trap

CNCF often tests the misconception that running as a non-root user (e.g., `runAsUser: 1000`) is sufficient, but the trap here is that `runAsUser: 0` explicitly sets root, which is a common mistake when candidates confuse 'default' with 'secure'—always drop all capabilities and make the filesystem read-only for defense in depth.

517
MCQhard

A cluster has a node that is NotReady. The kubelet on that node is not responding. Which command should be used to investigate the kubelet logs on the node?

A.kubectl logs <pod> --node=<node>
B.kubectl describe node <node>
C.kubectl get events --field-selector involvedObject.kind=Node
D.journalctl -u kubelet
AnswerD

journalctl -u kubelet is correct because on systemd-based Linux distributions, the kubelet is managed as a systemd service, and its stdout, stderr, and syslog messages are captured by the journal daemon. Running this command on the affected node retrieves the complete, timestamped log stream from that unit, revealing startup errors, connection failures, or config file issues. This is the standard method to inspect kubelet logs for diagnosing why a node is NotReady.

Why this answer

`journalctl -u kubelet` directly queries the systemd journal for logs from the kubelet service on the node. Since the kubelet is not responding, you cannot use `kubectl` to access its logs remotely; you must SSH into the node and use `journalctl` (or `systemctl status kubelet`) to read the kubelet's logs locally.

Exam trap

The trap here is that candidates assume `kubectl` can retrieve kubelet logs remotely, but `kubectl` only accesses pod/container logs via the kubelet API; when the kubelet itself is down, you must use node-level tools like `journalctl` or `systemctl`.

How to eliminate wrong answers

Option A is wrong because `kubectl logs <pod> --node=<node>` is not a valid syntax; `kubectl logs` retrieves logs from a specific pod container, not from the kubelet process, and the `--node` flag does not exist. Option B is wrong because `kubectl describe node <node>` shows the node's status and conditions (including NotReady) but does not provide the kubelet's logs, which are needed to diagnose why the kubelet is not responding. Option C is wrong because `kubectl get events --field-selector involvedObject.kind=Node` displays cluster events related to nodes, but these events are generated by the control plane, not by the kubelet itself, and they do not contain the detailed kubelet log output required to investigate a non-responsive kubelet.

518
MCQmedium

A pod has been scheduled on a node but is stuck in 'ContainerCreating' state. The team suspects a missing storage class. Which command would best confirm this?

A.kubectl describe node
B.kubectl get pvc
C.kubectl get storageclass
D.kubectl describe pod <pod>
AnswerD

kubectl describe pod <pod> displays the pod's full status, including the volume list, associated PVCs, container states, and crucially the Events section at the bottom. If the pod is stuck in ContainerCreating, the kubelet emits a FailedMount event with a message such as "unable to find storage class" or "no persistent volumes available for this claim," which directly identifies the missing storage class. This event is the authoritative source for the reason the pod cannot start, and the output also shows current conditions and volume definitions for a complete diagnostic picture.

Why this answer

`kubectl describe pod <pod>` provides detailed event logs and status conditions for the pod, including specific error messages like 'failed to provision volume with StorageClass' or 'storageclass.storage.k8s.io "<name>" not found'. This directly confirms whether a missing storage class is the root cause of the 'ContainerCreating' state, as the pod's events will surface the exact provisioning failure.

Exam trap

The trap here is that candidates assume checking the StorageClass list (`kubectl get storageclass`) or PVC status (`kubectl get pvc`) will reveal the missing class, but only the pod's detailed description shows the specific provisioning failure event tied to the missing StorageClass.

How to eliminate wrong answers

Option A is wrong because `kubectl describe node` shows node-level conditions, capacity, and resource usage, but does not reveal pod-level storage provisioning errors or missing storage class details. Option B is wrong because `kubectl get pvc` lists PersistentVolumeClaims and their status (e.g., Pending), but does not show the underlying error message about a missing storage class; a PVC might be stuck in Pending for other reasons like insufficient PV capacity. Option C is wrong because `kubectl get storageclass` only lists available storage classes in the cluster, but does not indicate which storage class a specific pod or PVC is trying to use, nor does it show the failure event.

519
Multi-Selecthard

Which THREE of the following are true about using 'kubectl rollout undo'? (Select three)

Select 3 answers
A.It rolls back to the previous revision by default
B.It can roll back to a specific revision using the --to-revision flag
C.It pauses the current rollout
D.It can be used on DaemonSets
E.It deletes the current Deployment and recreates it from scratch
AnswersA, B, D

When you run kubectl rollout undo with no flags, Kubernetes automatically selects the last available revision from the workload's rollout history and applies that configuration to replace the current pod template. This is a single-step revert that undoes only the most recent change, leaving older revisions untouched. If you need to return to an earlier state, you must explicitly specify --to-revision.

Why this answer

'kubectl rollout undo' without any flags reverts a Deployment to the previous revision (revision N-1) by default. This is the standard behavior for rollback operations in Kubernetes, where each change to a Deployment's pod template creates a new revision in the rollout history.

Exam trap

The trap here is that candidates confuse 'rollout undo' with 'rollout pause' or assume it destroys the Deployment, when in fact it only reverts the pod template to a previous revision while keeping the Deployment object intact.

520
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

The parallelism field in a Job spec directly sets the maximum number of pods that can run at the same time. With parallelism=2, the Job controller ensures no more than 2 pods are active concurrently, regardless of the completions count being 5.

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.

521
MCQeasy

What is the default service type in Kubernetes?

A.NodePort
B.ExternalName
C.ClusterIP
D.LoadBalancer
AnswerC

ClusterIP is the default service type when no `spec.type` is specified. It assigns the Service a stable virtual IP reachable only within the cluster, allowing pods to discover and route to the Service's endpoints via kube-proxy and DNS. This internal-facing default provides load balancing across pods without exposing traffic externally.

Why this answer

The default service type in Kubernetes is ClusterIP, which exposes the service on a cluster-internal IP address. This makes the service reachable only from within the cluster, enabling pod-to-pod communication without external access. If no `type` field is specified in the Service manifest, Kubernetes automatically sets `type: ClusterIP`.

Exam trap

The trap here is that candidates often assume NodePort or LoadBalancer is the default because they are more visible in external access scenarios, but Kubernetes defaults to ClusterIP for internal-only communication.

How to eliminate wrong answers

Option A is wrong because NodePort is not the default; it builds on ClusterIP by exposing the service on a static port on each node's IP, but must be explicitly set. Option B is wrong because ExternalName maps a service to a DNS name (e.g., an external database) and is not the default; it requires an explicit `type: ExternalName` and does not provide a cluster IP. Option D is wrong because LoadBalancer is an extension of NodePort that provisions an external load balancer (e.g., from a cloud provider) and is not the default; it must be explicitly configured.

522
Multi-Selecthard

Which THREE of the following are characteristics of Pod Security Admission (PSA) standards? (Select three.)

Select 3 answers
A.PSA can be configured to warn or audit violations without blocking
B.There are three predefined security levels: privileged, baseline, restricted
C.PSA requires Open Policy Agent (OPA) Gatekeeper to function
D.A namespace can be labeled to enforce a security level for all pods in that namespace
E.PSA is a CustomResourceDefinition (CRD) that must be installed separately
AnswersA, B, D

The Pod Security Admission controller supports three operational modes: enforce, warn, and audit. Enforce rejects violating pods at creation time, while warn and audit only record warnings or log audit events without blocking the pod. This allows cluster operators to test policies incrementally before enabling strict enforcement.

Why this answer

Pod Security Admission (PSA) supports three modes: enforce (blocks violations), audit (logs violations in audit logs), and warn (returns a warning to the user). This allows administrators to test or monitor PSA policies without immediately blocking pod creation, which is critical for gradual adoption.

Exam trap

The trap here is that candidates confuse PSA with third-party tools like OPA Gatekeeper or think it requires a CRD, when in fact PSA is a built-in, label-driven admission controller that works out of the box in Kubernetes v1.23+.

523
MCQeasy

Which Dockerfile instruction is used to define a mount point for a volume?

A.ADD
B.VOLUME
C.EXPOSE
D.MOUNT
AnswerB

VOLUME is the correct Dockerfile instruction because it explicitly creates a mount point and marks it as a location for external storage volumes. When a container is run, Docker automatically creates an anonymous volume at that path unless a named volume or bind mount is supplied via the run command or compose file. This instruction is essential for defining persistent data locations, as it tells Docker that the specified directory should be preserved independently of the container's writable layer and can be shared between containers.

Why this answer

The VOLUME instruction in a Dockerfile creates a mount point at the specified path within the container, marking it as holding externally mounted volumes from the host or other containers. This is the correct way to declare a volume in the Dockerfile, ensuring data persistence and enabling volume sharing between containers.

Exam trap

The trap here is that candidates confuse the Dockerfile VOLUME instruction with the `docker run -v` or `--mount` runtime flags, or mistakenly think EXPOSE or ADD can define volumes, when only VOLUME in the Dockerfile declares the mount point.

How to eliminate wrong answers

Option A is wrong because ADD is used to copy files, directories, or remote URLs into the image, not to define volume mount points. Option C is wrong because EXPOSE documents which ports the container listens on at runtime, but does not create or define volumes. Option D is wrong because MOUNT is not a valid Dockerfile instruction; the correct instruction is VOLUME.

524
MCQmedium

You need to check the CPU and memory usage of a pod named 'monitored-pod' in the 'default' namespace. Which command should you run?

A.kubectl get pod monitored-pod -o wide
B.kubectl describe pod monitored-pod
C.kubectl top pod monitored-pod
D.kubectl logs monitored-pod
AnswerC

`kubectl top pod` is the only command here that talks to the Kubernetes Metrics API, which the Metrics Server populates by scraping kubelet's cAdvisor endpoint. It prints the actual instantaneous CPU and memory utilization per container, e.g., `100m` and `120Mi`, giving you a direct view of live usage. That exactly matches the task of checking the pod's CPU and memory usage.

Why this answer

`kubectl top pod` is the command specifically designed to display real-time CPU and memory usage metrics for pods in Kubernetes. It relies on the metrics server to collect resource usage data and presents it in a concise table format, making it the appropriate tool for checking resource consumption of 'monitored-pod'.

Exam trap

The trap here is that candidates may confuse `kubectl describe` or `kubectl get -o wide` as sources of live resource usage, when in fact they only show static resource requests/limits or network info, not dynamic CPU/memory consumption.

How to eliminate wrong answers

Option A is wrong because `kubectl get pod -o wide` shows additional networking details like node IP and pod IP, but does not include CPU or memory usage metrics. Option B is wrong because `kubectl describe pod` provides detailed metadata, events, and container resource requests/limits, but not live CPU and memory usage. Option D is wrong because `kubectl logs` retrieves container log output (stdout/stderr), not resource utilization data.

525
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 --from=builder /app/artifact /app/ is the standard multi-stage mechanism: it tells the current build stage to take the file or directory at /app/artifact from the stage named builder and place it at /app in the new image layer. This instruction is explicit about the source stage, avoids ADD's archive-extraction side effects, and lets you keep build-only tools out of the final runtime image. The artifact is copied directly from the builder stage's filesystem into the next stage's filesystem.

Why this answer

The COPY instruction with the --from flag is specifically designed for multi-stage builds to copy files from a previous build stage (or an external image) into the current stage. It only copies local files or directories from the specified stage, making it the correct and efficient way to transfer artifacts like compiled binaries. This avoids including unnecessary build dependencies in the final image.

Exam trap

CKAD often tests the misconception that ADD or RUN can be used with --from to copy from another stage, but only COPY supports the --from flag for multi-stage artifact transfer.

How to eliminate wrong answers

Option A is wrong because ADD does not support the --from flag; ADD is used for adding files from a URL or extracting tarballs, but it cannot reference other build stages. Option B is wrong because RUN executes a command in the current stage's shell, and the --from flag is not valid for RUN; you cannot directly copy from another stage using RUN without first mounting or using a multi-stage copy. Option D is wrong because CMD sets the default command for the container at runtime and does not perform any file copying; it cannot reference build stages.

Page 6

Page 7 of 12

Page 8