All Linux Foundation / CNCF exams

Free CKAD practice test: 30 questions with answers

30 original questions for Certified Kubernetes Application Developer, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.

Free questions
30
Full bank
100 questions

CKAD exam guide: topics, cost and format

All 30 CKAD questions with answers

The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.

Application Environment, Configuration and Security (6 questions)

  1. Question 1

    Which two approaches keep a database password out of a container image? (Choose two.)

    1. AHard-code the password in the Dockerfile
    2. BStore the password in a ConfigMap and print it in the logs
    3. CBake the password into the image's environment variables
    4. DReference the password through a Secret object managed outside the image
    5. EMount the password from a Secret as an environment variable or a file
    Show answer and explanation
    Correct answer: D, E

    Secrets injected at runtime, either as environment variables or files, keep credentials out of images. Dockerfiles, ConfigMaps used for secrets, and baked-in variables all embed the password in artifacts or logs.

  2. Question 2

    An application reads its settings from a ConfigMap. The team changes a value and wants the running pods to use it without rebuilding the image. What should they know?

    1. AThe ConfigMap is deleted and recreated automatically by the controller manager on every change, which triggers a rollout
    2. BEnvironment variables from the ConfigMap update in real time without a restart, because the kubelet re-reads them
    3. CPods consuming the ConfigMap as environment variables must be restarted to see the change, while mounted files update automatically
    4. DNothing changes in the running pods until the container image is rebuilt and the Deployment is rolled out
    Show answer and explanation
    Correct answer: C

    Environment variables are read at container start, so pods must restart to pick up changes, while ConfigMap volumes are updated in place. Rebuilding the image is unnecessary, and deletion or real-time environment updates are incorrect.

  3. Question 3

    A pod must run with a specific user ID and must not be allowed to escalate privileges inside the container. Which settings achieve this?

    1. ARunning the pod with privileged: true, which grants the container full access to host devices
    2. BBinding the container's service account to the cluster-admin ClusterRole for the namespace
    3. CsecurityContext with runAsUser set and allowPrivilegeEscalation set to false
    4. DMounting the host's root filesystem into the container through a hostPath volume
    Show answer and explanation
    Correct answer: C

    A securityContext with a non-root user and privilege escalation disabled restricts the container. Privileged mode, host root mounts, and cluster-admin rights each expand the container's power dramatically.

  4. Question 4

    A namespace must limit the total CPU and memory that its workloads can request, so that one team cannot exhaust the cluster. Which resource enforces this?

    1. AA LimitRange with a very high maximum for each pod
    2. BA label on the namespace
    3. CA ConfigMap with the team's budget
    4. DA ResourceQuota in the namespace
    Show answer and explanation
    Correct answer: D

    A ResourceQuota caps aggregate resource requests and limits in a namespace. A LimitRange sets per-container defaults and bounds, labels are metadata, and ConfigMaps do not enforce limits.

  5. Question 5

    A container must not run as root, and the team wants the cluster to refuse pods that do. Which mechanism enforces this at admission?

    1. AA Pod Security admission level such as restricted for the namespace
    2. BA comment in the deployment file asking developers not to use root
    3. CAdding a sticker to the pod's label
    4. DRunning the cluster with root disabled by reading the documentation
    Show answer and explanation
    Correct answer: A

    Pod Security admission enforces standards at creation time, and the restricted level rejects root containers. Comments and documentation are advisory, and labels do not enforce runtime policy.

  6. Question 6

    A pod should reserve a minimum amount of CPU for scheduling and be limited to a maximum. Which fields should be set?

    1. AThe namespace name, which determines the CPU reservation for each container
    2. BThe container's image tag, which selects the exact build
    3. CThe labels of the pod, used by Service selectors
    4. DResource requests for the minimum and limits for the maximum
    Show answer and explanation
    Correct answer: D

    Requests guide scheduling by reserving a minimum, and limits cap usage at a maximum. Labels, image tags, and namespace names do not control resource reservation.

Application Observability and Maintenance (6 questions)

  1. Question 7

    A pod is running but the team wants Kubernetes to restart it automatically if the application stops responding to HTTP requests. Which feature should be configured?

    1. AA liveness probe that checks the HTTP endpoint
    2. BA readiness probe that drops traffic, with no restart
    3. CA label on the pod that the Service selector matches
    4. DA larger memory request for the container
    Show answer and explanation
    Correct answer: A

    A liveness probe checks whether the container is healthy and restarts it when the check fails. A readiness probe only controls traffic routing, and memory requests and labels do not detect unresponsive apps.

  2. Question 8

    A pod must receive traffic only after the application has loaded its data. Which probe should be configured?

    1. AA readiness probe
    2. BA liveness probe with a very short timeout
    3. CNo probe, because the pod receives traffic immediately
    4. DA startup probe that sends traffic only once
    Show answer and explanation
    Correct answer: A

    A readiness probe determines when a pod is ready to receive traffic, which is the requirement here. Liveness probes restart unhealthy containers, and a startup probe delays other probes rather than gating traffic.

  3. Question 9

    A developer wants to see why a pod keeps restarting. Which command gives the most useful information first?

    1. Akubectl describe pod and kubectl logs with the previous container flag
    2. Bkubectl config view to inspect the kubeconfig contexts
    3. Ckubectl version to compare the client and server build versions in use today
    4. Dkubectl get nodes -o wide to list node status, roles, and IPs
    Show answer and explanation
    Correct answer: A

    Describe shows events such as probe failures and OOM kills, and logs from the previous container show the crash output. Node listings, version, and kubeconfig views do not explain a pod's restarts.

  4. Question 10

    A developer wants to find the top CPU and memory users among pods in a namespace. Which tool or command provides this quickly?

    1. Akubectl explain service --recursive to list the schema fields
    2. Bkubectl top pods, if the metrics server is installed
    3. Ckubectl get secrets -n namespace to list the stored keys
    4. Dkubectl label pods --all with a usage annotation
    Show answer and explanation
    Correct answer: B

    kubectl top pods reports current resource usage when the metrics server is installed. Listing secrets, explaining fields, and labeling pods do not report usage.

  5. Question 11

    Which two commands help inspect a pod's configuration and current state? (Choose two.)

    1. Akubectl get pod -o yaml
    2. Bkubectl delete pod --all
    3. Ckubectl drain pod
    4. Dkubectl cordon pod
    5. Ekubectl describe pod
    Show answer and explanation
    Correct answer: A, E

    Describe shows events and status, and get with YAML output shows the full object as stored. Deleting pods, draining, and cordoning change cluster state rather than inspect it.

  6. Question 12

    An application writes errors to standard error, and the team needs to read them for a pod that has already been replaced. Which command helps retrieve logs from the earlier container instance?

    1. Akubectl logs with the --previous flag for the pod
    2. Bkubectl edit deployment to change the container image tag
    3. Ckubectl get pods --all-namespaces -o wide to list IPs
    4. Dkubectl drain node worker-2 to evict its pods for maintenance
    Show answer and explanation
    Correct answer: A

    The --previous flag shows logs from the last terminated container instance of a pod, which helps diagnose crashes. Listing pods, editing deployments, and draining nodes do not show earlier container output.

Services and Networking (6 questions)

  1. Question 13

    A pod inside the cluster must reach a backend that runs in other pods behind a stable name and virtual IP. Which resource provides this?

    1. AA NodePort Service on a random port only
    2. BA pod with a changing IP address that others call directly
    3. CAn Ingress resource with no backend Service
    4. DA ClusterIP Service
    Show answer and explanation
    Correct answer: D

    A ClusterIP Service gives a stable name and virtual IP that load-balances to matching pods. Direct pod IPs change when pods are replaced, and an Ingress needs a backend Service to route to.

  2. Question 14

    An application must be reachable from outside the cluster over HTTPS with routing by host name. Which resource is most appropriate?

    1. AAn Ingress with a TLS section and host rules
    2. BA ClusterIP Service for in-cluster access
    3. CA PersistentVolumeClaim for web traffic
    4. DA ConfigMap listing the public host name
    Show answer and explanation
    Correct answer: A

    An Ingress defines host-based routing and TLS termination in front of Services. ClusterIP Services are internal-only, ConfigMaps do not route traffic, and PersistentVolumeClaims provide storage.

  3. Question 15

    Which two statements about NetworkPolicy resources are correct? (Choose two.)

    1. AThey replace the need for Services
    2. BThey control which pods may send or receive traffic when the network plugin enforces them
    3. CThey take effect even when the network plugin does not support NetworkPolicy
    4. DThey select pods using label selectors
    5. EThey are applied to nodes instead of pods
    Show answer and explanation
    Correct answer: B, D

    NetworkPolicies use pod label selectors and are enforced only when the cluster's network plugin supports them. They apply to pods rather than nodes and do not replace Services.

  4. Question 16

    A pod must resolve the name of a Service in another namespace. Which DNS name format should be used?

    1. Aservice-name.namespace-name.svc.cluster.local
    2. Bnamespace-name only, with no service name
    3. Cthe pod's IP address written as a word
    4. Dservice-name only, because DNS is global across all namespaces
    Show answer and explanation
    Correct answer: A

    Cluster DNS names for Services follow the service.namespace.svc pattern, which resolves across namespaces. A bare service name only resolves within its own namespace, and namespace names alone or IP words do not resolve a Service.

  5. Question 17

    Which two statements about Kubernetes Services are correct? (Choose two.)

    1. AA NodePort Service exposes a port on every node
    2. BA Service always keeps the same pod IP address
    3. CA ClusterIP Service is reachable from the internet by default
    4. DA Service stores container images
    5. EA Service selects pods using labels
    Show answer and explanation
    Correct answer: A, E

    Services use label selectors to find pods, and NodePort exposes the service on a port on each node. Pod IPs change over time, ClusterIP is internal by default, and Services do not store images.

  6. Question 18

    An application needs to send traffic to a service outside the cluster by its DNS name, and the cluster DNS must resolve that name correctly. Which resource can provide the external name mapping?

    1. AA ConfigMap containing the external IP
    2. BAn ExternalName Service
    3. CA DaemonSet on every node
    4. DA PersistentVolume
    Show answer and explanation
    Correct answer: B

    An ExternalName Service maps an in-cluster name to an external DNS name through cluster DNS. ConfigMaps do not perform name resolution, PersistentVolumes provide storage, and DaemonSets run node agents.

Application Design and Build (6 questions)

  1. Question 19

    A developer needs a container that runs to completion once to prepare data before the main application starts. Which Kubernetes construct fits best?

    1. AA ReplicaSet with three replicas
    2. BA second long-running container in the same pod
    3. CA DaemonSet that runs on every node
    4. DAn init container in the pod spec
    Show answer and explanation
    Correct answer: D

    Init containers run to completion before the app containers start, which suits one-time preparation. A second long-running container runs alongside the app, a DaemonSet targets nodes, and a ReplicaSet maintains replicas of a long-running pod.

  2. Question 20

    A team wants to run a batch job that must finish successfully and then stop, with retries if a pod fails. Which resource should they create?

    1. AA StatefulSet with a headless service
    2. BA Job
    3. CA ConfigMap with the job's command
    4. DA Deployment with restartPolicy Always
    Show answer and explanation
    Correct answer: B

    A Job runs pods until a specified number complete successfully and retries failures. Deployments keep pods running continuously, StatefulSets manage stateful identity, and ConfigMaps store configuration rather than run work.

  3. Question 21

    A pod needs a writable directory that survives container restarts within the same pod, and the data is shared between two containers in that pod. Which volume type fits?

    1. ANo volume, since containers can share data through their own filesystems
    2. BAn emptyDir volume mounted into both containers
    3. CA projected volume with the secret values
    4. DA hostPath volume on a single node that is shared with other pods
    Show answer and explanation
    Correct answer: B

    An emptyDir volume is shared by containers in the same pod and survives container restarts while the pod exists. hostPath ties data to one node and exposes the host, and containers do not share their own filesystems.

  4. Question 22

    A stateful application needs each replica to keep a stable network identity and its own persistent volume. Which workload type fits?

    1. AA Deployment with a shared volume for all pods
    2. BA Job
    3. CA DaemonSet
    4. DA StatefulSet
    Show answer and explanation
    Correct answer: D

    StatefulSets give each replica a stable name and its own persistent storage across rescheduling. Deployments do not guarantee stable identities, Jobs run to completion, and DaemonSets place one pod per node.

  5. Question 23

    A developer wants a single container image to run with different settings in test and production without rebuilding it. Which approach fits?

    1. ABuild a separate image for each setting combination by hand and push each one
    2. BEdit the image layers by hand after each build, then re-sign the layers and repush
    3. CSupply the environment-specific settings through ConfigMaps or Secrets at deployment time
    4. DHard-code both sets of settings in the image at build time, one per Dockerfile
    Show answer and explanation
    Correct answer: C

    Injecting configuration at deployment time keeps the image identical across environments. Separate hand-built images, hard-coded settings, and manual layer edits break that consistency.

  6. Question 24

    A developer must define a multi-container pod where a sidecar container ships logs from the application container. Which pod design is correct?

    1. AOne container that runs both the application and the log shipper in one process
    2. BBoth containers in the same pod spec, sharing a volume for the log directory
    3. CA Job that runs the log shipper after the application finishes
    4. DTwo separate pods on different nodes communicating only through the internet
    Show answer and explanation
    Correct answer: B

    Containers in the same pod share network and volumes, which lets a sidecar read the application's logs. Separate pods on different nodes add latency and complexity, combining processes removes the separation, and a Job after the app misses live logs.

Application Deployment (6 questions)

  1. Question 25

    A deployment must update its pods gradually so that some replicas always remain available during the update. Which strategy should be configured?

    1. ARecreate, which stops all pods before starting new ones
    2. BRollingUpdate with maxUnavailable and maxSurge settings
    3. CDeleting the deployment and creating it again
    4. DEditing each pod by hand
    Show answer and explanation
    Correct answer: B

    RollingUpdate replaces pods gradually, and maxUnavailable and maxSurge control how many can be down or extra. Recreate causes downtime, and deleting or hand-editing pods is error-prone and disruptive.

  2. Question 26

    A team needs to roll back a Deployment to the previous revision after a bad release. Which command achieves this?

    1. Akubectl create deployment web again
    2. Bkubectl scale deployment/web --replicas=0
    3. Ckubectl rollout undo deployment/web
    4. Dkubectl delete pod --all
    Show answer and explanation
    Correct answer: C

    kubectl rollout undo reverts a Deployment to its previous revision. Deleting all pods, scaling to zero, or recreating the deployment do not restore the previous revision cleanly.

  3. Question 27

    A team wants to run a new version alongside the old one and switch all traffic at once after testing. Which approach fits best?

    1. AEditing the running pods in place with kubectl edit and letting the existing ReplicaSet
    2. BDeleting the old pods before the new ones are created, which empties the Service
    3. CBlue-green deployment using two Deployments and a Service selector switch
    4. DRolling update with maxUnavailable set to 100 percent and maxSurge set to 0
    Show answer and explanation
    Correct answer: C

    Blue-green uses two versions and switches the Service selector after validation, which gives a fast, all-at-once cutover. A rolling update changes gradually, in-place edits are fragile, and deleting first causes an outage.

  4. Question 28

    A team wants its Deployment to run exactly one pod on each worker node for a log collector. Which workload type fits?

    1. AA StatefulSet with three replicas
    2. BA DaemonSet
    3. CA Job with completions set to the number of nodes
    4. DA ReplicaSet with a fixed replica count of one
    Show answer and explanation
    Correct answer: B

    A DaemonSet runs one pod on each eligible node, which suits node-level agents like log collectors. A Job runs to completion, StatefulSets are for stable identity, and a single-replica ReplicaSet does not place a pod on every node.

  5. Question 29

    A Deployment must be scaled from three to five replicas immediately. Which command does this?

    1. Akubectl delete deployment web --replicas=5
    2. Bkubectl expose deployment web --replicas=5
    3. Ckubectl scale deployment web --replicas=5
    4. Dkubectl label deployment web replicas=5
    Show answer and explanation
    Correct answer: C

    kubectl scale changes the replica count of a Deployment directly. Deleting, exposing, and labeling do not change the number of replicas.

  6. Question 30

    A release requires that a new image version be tested on a few users before a full rollout, with the ability to stop the rollout. Which approach fits within plain Kubernetes primitives?

    1. ATwo Deployments with different labels and a Service that splits traffic by replica count, adjusted gradually
    2. BDeleting pods from the existing Deployment in one step and hoping the new version starts cleanly on replacement pods
    3. CTurning off the Service for the rollout period by clearing its selector to match no pods, so that incoming requests are refused.
    4. DEditing the image reference on every worker node by hand, then restarting the kubelet on each host so the new tag is picked up
    Show answer and explanation
    Correct answer: A

    Running two Deployments with a Service that routes by replica proportion gives a simple canary, which can be stopped or expanded. Deleting pods, hand edits on nodes, and turning off the Service are disruptive or unsafe.

Want more CKAD questions?

The full bank has 100 questions with answers and explanations, as a PDF, an online practice exam, or both.

Full question bank · 100 questions
$89$124

Both formats together. The best value.

Instant access after payment, with 90 days of updates. Checkout is on our store, AIExamCerts.