All Linux Foundation / CNCF exams

Free CKA practice test: 30 questions with answers

30 original questions for Certified Kubernetes Administrator, 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

CKA exam guide: topics, cost and format

All 30 CKA questions with answers

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

Workloads and Scheduling (6 questions)

  1. Question 1

    A Deployment named web must roll out a new image while keeping at least two replicas available at all times. Which strategy setting should be configured?

    1. AA Recreate strategy which scales the old ReplicaSet down to zero before the new pods are scheduled
    2. BA RollingUpdate strategy with maxUnavailable set to 0 or 1 and an appropriate maxSurge
    3. CSetting replicas to 0 with kubectl scale deployment web --replicas=0 before using the new image
    4. DDeleting the web Deployment, then creating a new one from a revised manifest with the new image tag
    Show answer and explanation
    Correct answer: B

    RollingUpdate with a controlled maxUnavailable keeps capacity available during the change. Recreate stops all pods first, scaling to zero causes downtime, and deleting the Deployment removes the workload.

  2. Question 2

    A team needs to run a job that processes a batch once and then completes, retrying up to three times on failure. Which resource fits best?

    1. AA StatefulSet with stable network identities
    2. BA ReplicaSet with three replicas that never stop
    3. CA Job with backoffLimit set to 3
    4. DA DaemonSet that runs on every node continuously
    Show answer and explanation
    Correct answer: C

    A Job runs pods to completion and retries up to backoffLimit. DaemonSets run continuously on nodes, StatefulSets provide stable identities for stateful apps, and ReplicaSets keep long-running replicas.

  3. Question 3

    A workload should run one pod on every worker node, such as a log collector. Which controller should be used?

    1. ACronJob
    2. BReplicaSet with a fixed count of 1
    3. CJob
    4. DDaemonSet
    Show answer and explanation
    Correct answer: D

    A DaemonSet ensures one pod runs on each eligible node, including nodes that join later. A Job or CronJob runs to completion, and a fixed ReplicaSet does not cover every node.

  4. Question 4

    A pod remains in Pending state with the event 0/3 nodes are available: 3 Insufficient cpu. What is the most likely cause?

    1. AThe pod's container image name is misspelled
    2. BThe pod requests more CPU than any node has available
    3. CThe pod's DNS policy is wrong for the cluster
    4. DThe pod has a liveness probe that is too strict on each boot
    Show answer and explanation
    Correct answer: B

    The scheduler reports insufficient CPU when the requested resources do not fit on any node. Image errors appear as image pull failures, DNS policy and probes affect running pods rather than scheduling.

  5. Question 5

    A workload must be scheduled only on nodes labeled disktype=ssd. Which pod spec setting enforces this?

    1. AnodeSelector with disktype: ssd
    2. BcontainerPort with ssd
    3. ChostAliases with the label value
    4. DA readiness probe on port 22
    Show answer and explanation
    Correct answer: A

    nodeSelector restricts scheduling to nodes carrying the matching label. hostAliases edits hosts files, containerPort declares ports, and probes check health.

  6. Question 6

    A node is being taken out for maintenance and its pods must move to other nodes safely. Which sequence is correct?

    1. AReboot the node first and then verify which pods were running
    2. BRemove the kubelet binary without changing node scheduling
    3. CCordon the node, then drain it while ignoring DaemonSet pods if needed
    4. DDelete the node object immediately without graceful draining
    Show answer and explanation
    Correct answer: C

    Cordoning stops new scheduling, and draining evicts pods gracefully so controllers recreate them elsewhere. Deleting the node object or rebooting without draining causes abrupt disruption.

Cluster Architecture, Installation and Configuration (6 questions)

  1. Question 7

    An administrator needs to upgrade a kubeadm-based control plane from v1.31 to v1.32. Which order of operations is correct on the first control-plane node?

    1. AUpgrade the kubelet first on node, then run kubeadm upgrade apply without changing the kubeadm binary from v1.31
    2. BUpgrade the worker nodes first using kubeadm upgrade node, then move on to the control plane components
    3. CUpgrade the kubeadm binary, run kubeadm upgrade plan, then kubeadm upgrade apply, then drain and upgrade kubelet and kubectl
    4. DDelete the control plane static pod manifests and reinstall it from scratch with a fresh kubeadm init on this node
    Show answer and explanation
    Correct answer: C

    kubeadm must be upgraded first, then the plan is checked and applied on the control plane, after which kubelet and kubectl are upgraded with the node drained. Upgrading kubelet first or reinstalling the control plane breaks the supported order, and workers come after the control plane.

  2. Question 8

    A kubelet on a worker node fails to start after a configuration change. Which file should the administrator inspect to see the kubelet's flags and configuration location?

    1. AThe application's ConfigMap in the default namespace, which holds the environment settings
    2. BThe application container image's Dockerfile defines the base image, ENTRYPOINT, and build-time arguments in CI
    3. CThe kubelet systemd unit and its drop-in files, such as under /etc/systemd/system/kubelet.service.d
    4. DThe Ingress controller manifest and its IngressClass resource that routes HTTP traffic
    Show answer and explanation
    Correct answer: C

    The kubelet runs as a systemd service, and its unit and drop-in files define startup flags and config paths. Application ConfigMaps, Dockerfiles and Ingress manifests do not control kubelet startup.

  3. Question 9

    An administrator wants to give a user named dev1 read-only access to pods in the namespace staging only. Which command creates the required binding to an existing ClusterRole named view?

    1. Akubectl create clusterrolebinding dev1v --clusterrole=view --user=dev1
    2. Bkubectl create role dev1-ops --verb=delete --resource=pods --resource-name=web1 -n staging
    3. Ckubectl label namespace staging owner=dev1 team=billing --overwrite
    4. Dkubectl create rolebinding dev1-view --clusterrole=view --user=dev1 -n staging
    Show answer and explanation
    Correct answer: D

    A RoleBinding in the staging namespace that references the view ClusterRole limits the granted permissions to that namespace. A ClusterRoleBinding would apply cluster-wide, a delete Role grants the wrong verb, and a label does not grant access.

  4. Question 10

    A pod in namespace ops must use the service account deploy-bot to call the API. Which field in the pod spec sets this?

    1. Aspec.serviceAccountName
    2. Bspec.template.spec.priority
    3. Cspec.nodeSelectorTerms
    4. Dspec.hostAliases.ip
    Show answer and explanation
    Correct answer: A

    spec.serviceAccountName selects the service account whose token the pod uses. nodeName pins scheduling, hostAliases edits /etc/hosts, and priorityClassName sets scheduling priority.

  5. Question 11

    Which command shows whether the current user is allowed to create deployments in the namespace finance?

    1. Akubectl auth can-i create deployments -n finance
    2. Bkubectl top nodes --selector=role=db --sort-by=memory
    3. Ckubectl get nodes --show-labels -l zone=east1 -o wide
    4. Dkubectl describe pods --all-namespaces
    Show answer and explanation
    Correct answer: A

    kubectl auth can-i checks authorization for a verb and resource in a namespace. Listing nodes, describing pods and showing resource usage do not answer the permission question.

  6. Question 12

    An administrator must back up the etcd datastore of a kubeadm cluster before maintenance. Which command creates a snapshot?

    1. Akubectl backup etcd --raw --namespace=kube-system --output=/backup/etcd-snap-01.db
    2. Betcdctl snapshot save with the endpoints, cacert, cert, and key flags
    3. Ctar -czvf /backups/kubelet.tar.gz /var/lib/kubelet/pods /etc/systemd/system
    4. Dkubeadm reset --force --cri-socket=/var/run/cri/cri.sock
    Show answer and explanation
    Correct answer: B

    etcdctl snapshot save, with the correct endpoint and TLS flags, creates a consistent etcd backup. kubectl has no etcd backup subcommand, kubelet directories do not contain cluster state, and kubeadm reset removes the node's configuration.

Troubleshooting (6 questions)

  1. Question 13

    A pod is in CrashLoopBackOff. Which command shows the logs from the previous container instance that crashed?

    1. Akubectl get nodes --all-namespaces
    2. Bkubectl logs pod-name --previous
    3. Ckubectl describe namespace default
    4. Dkubectl top pods only
    Show answer and explanation
    Correct answer: B

    kubectl logs with --previous shows output from the last terminated container, which usually contains the crash reason. The other commands do not show container logs from the crashed instance.

  2. Question 14

    A node shows NotReady in kubectl get nodes. Which component on that node should be inspected first?

    1. AThe Ingress controller's replicas
    2. BThe Helm release history
    3. CThe etcd cluster snapshot schedule
    4. DThe kubelet service and its logs
    Show answer and explanation
    Correct answer: D

    A NotReady node usually means the kubelet is not reporting properly, so its service status and logs are the first check. Snapshot schedules, Ingress replicas and Helm history are unrelated to node readiness.

  3. Question 15

    A user reports that a Service is not reachable from a pod, but the pod can reach other pods by IP. Which check is most useful first?

    1. AVerifying the Service selector, endpoints, and the port mapping between the Service and the target pods
    2. BDeleting the namespace and recreating the Service, Deployment, and PVCs from scratch again
    3. CRebooting the node the pod runs on to reset the kubelet, container runtime, and CNI
    4. DChanging the pod's image to a newer version and rebuilding the Deployment with a fresh base
    Show answer and explanation
    Correct answer: A

    Checking selectors, endpoints and port mappings identifies where traffic is lost. Rebooting, image changes and namespace deletion are disruptive and do not target the likely cause.

  4. Question 16

    Which two checks help diagnose a pod that stays in Pending? (Choose two.)

    1. AThe Ingress host name configured for another service
    2. BThe label color of the namespace
    3. Ckubectl describe pod events showing the scheduler's reasons
    4. DNode resources and taints compared with the pod's requests and tolerations
    5. EThe application log from the last crash of the container
    Show answer and explanation
    Correct answer: C, D

    Scheduler events and node capacity or taint mismatches explain why a pod cannot be placed. Application logs from crashes, Ingress host names and label colors do not explain scheduling failures.

  5. Question 17

    A node reports DiskPressure and pods are being evicted. What is the first action to take?

    1. ARemoving the kubelet from the node and reinstalling it with a larger storage quota to raise the eviction thresholds
    2. BScheduling more pods on the node by lowering the requests of every existing container so the scheduler can place more
    3. CTurning off the node's network interface and disabling the CNI plugin routes and kube-proxy
    4. DIdentifying what is consuming disk space on the node and freeing space, such as unused images or logs
    Show answer and explanation
    Correct answer: D

    Finding and freeing disk space, such as unused images and large logs, resolves pressure and stops evictions. Removing kubelet, adding pods and disabling networking make the problem worse.

  6. Question 18

    A deployment's pods are running but users see errors. The team wants the last 100 log lines from all pods with the label app=web. Which command gives this?

    1. Akubectl describe node -l app=web
    2. Bkubectl top nodes --tail=100
    3. Ckubectl logs -l app=web --tail=100
    4. Dkubectl get pods -l app=web --watch-only
    Show answer and explanation
    Correct answer: C

    kubectl logs with a label selector and --tail retrieves recent logs from matching pods. Watch, node description and top do not display the application logs.

Services and Networking (6 questions)

  1. Question 19

    An application outside the cluster must reach a Service on a node port. Which Service type should be used?

    1. AClusterIP
    2. BNodePort
    3. CExternalName only for internal DNS
    4. DHeadless Service with no selector
    Show answer and explanation
    Correct answer: B

    NodePort exposes the Service on a port on each node so external clients can reach it. ClusterIP is internal only, ExternalName maps DNS names, and a headless Service without a selector does not route to pods.

  2. Question 20

    A Service exists but requests to it fail. kubectl get endpoints shows no addresses for the Service. What is the most likely cause?

    1. AThe Service selector does not match any pod labels, or the matching pods are not Ready
    2. BThe node has no CPU label, so the Service cannot bind to its virtual IP and endpoints stay empty
    3. CThe Service's name is too long for DNS, so kube-proxy skips these rules
    4. DThe cluster's DNS server is turned off permanently in the kube-system
    Show answer and explanation
    Correct answer: A

    Endpoints are populated from pods matching the selector that are Ready, so a mismatch or unready pods leaves endpoints empty. Name length and CPU do not control endpoints, and DNS problems produce name resolution errors.

  3. Question 21

    Which two Service types expose a Service outside the cluster? (Choose two.)

    1. ANodePort
    2. BClusterIP
    3. CA headless Service without a selector
    4. DExternalName on its own
    5. ELoadBalancer
    Show answer and explanation
    Correct answer: A, E

    LoadBalancer and NodePort make a Service reachable from outside the cluster. ClusterIP is internal only, and headless and ExternalName services do not provide that exposure by themselves.

  4. Question 22

    A Service must be reachable from pods in another namespace using a stable name. Which DNS format should the application use?

    1. Apod-ip-address.namespace.pod.local
    2. Bservice-name.namespace.svc.cluster.local
    3. Cnamespace.service-name.svc.local.cluster.internal
    4. Dnode-name.service.worker.cluster
    Show answer and explanation
    Correct answer: B

    The fully qualified cluster DNS name includes the service, namespace and svc.cluster.local suffix. The other formats do not follow the Kubernetes service DNS pattern.

  5. Question 23

    An Ingress resource is created, but no traffic reaches the backend. Which component must exist for the Ingress to take effect?

    1. AAn Ingress controller that watches Ingress resources
    2. BA ServiceAccount named ingress bound to pods
    3. CA PersistentVolume bound with a Retain policy
    4. DA ConfigMap holding the backend pod IP address and port
    Show answer and explanation
    Correct answer: A

    An Ingress resource does nothing without an Ingress controller that implements it. Storage, ConfigMaps and ServiceAccounts do not route HTTP traffic.

  6. Question 24

    A Service of type ClusterIP must be exposed to the cluster DNS as a headless service for direct pod addressing. Which setting is required?

    1. AclusterIP: None
    2. Btype: NodePort
    3. CexternalTrafficPolicy: Local
    4. DsessionAffinity: ClientIP only
    Show answer and explanation
    Correct answer: A

    Setting clusterIP to None creates a headless Service, which returns pod addresses through DNS. NodePort, external traffic policy and session affinity do not make a Service headless.

Storage (6 questions)

  1. Question 25

    A pod needs persistent storage that survives pod restarts and is provisioned on demand from a StorageClass. Which object should the pod reference?

    1. AAn emptyDir volume only
    2. BA downward API volume
    3. CA ConfigMap
    4. DA PersistentVolumeClaim
    Show answer and explanation
    Correct answer: D

    A PVC requests storage that is dynamically provisioned through a StorageClass and persists beyond the pod. ConfigMaps hold configuration, emptyDir is ephemeral, and the downward API exposes metadata.

  2. Question 26

    A PersistentVolumeClaim is stuck in Pending because no PersistentVolume matches. The cluster has a default StorageClass. What should the administrator check first?

    1. AWhether the pod's image tag is latest, since an unpinned image reference can pull a different build than the one tested in UAT env
    2. BWhether the Service type is NodePort or LoadBalancer, which exposes a node port on the host
    3. CWhether the StorageClass provisioner is installed and the claim's storage class and access mode are compatible
    4. DWhether the node has a label named zone, which the cloud provider sets for kubelet's log rotation
    Show answer and explanation
    Correct answer: C

    A pending claim usually means the provisioner is unavailable or the requested class, size or access mode cannot be satisfied. Image tags, Service types and unrelated labels do not affect claim binding.

  3. Question 27

    A StorageClass should be used for dynamic provisioning of volumes in a cloud environment, with the reclaim policy set to Delete. What happens when the claim is deleted?

    1. AThe volume is kept, detached, and moved to a new cluster with the same data
    2. BThe claim is converted into a ConfigMap holding its volume
    3. CThe dynamically provisioned volume is deleted along with its data
    4. DNothing happens to the volume because StorageClasses ignore claims
    Show answer and explanation
    Correct answer: C

    A Delete reclaim policy removes the underlying volume when its claim is deleted, which removes the data. Retaining, converting to ConfigMaps and ignoring claims do not describe this policy.

  4. Question 28

    A pod needs temporary scratch space shared between two containers in the same pod. Which volume type is appropriate?

    1. AA NetworkPolicy
    2. BA Secret volume with write access
    3. CA PersistentVolume with ReadWriteMany for scratch data
    4. DemptyDir
    Show answer and explanation
    Correct answer: D

    emptyDir gives containers in the same pod shared scratch space that lives with the pod. A PersistentVolume is unnecessary for scratch data, NetworkPolicies do not provide storage, and Secret volumes are read-only data sources.

  5. Question 29

    A workload needs to mount a volume that several pods on different nodes write to at the same time. Which access mode is needed on the PersistentVolume?

    1. ANo access mode is needed for a local emptyDir
    2. BReadWriteMany, if the storage backend supports it
    3. CReadOnlyOnce on a single node, shared by pods scheduled there
    4. DReadWriteOnce mounted by several nodes at once
    Show answer and explanation
    Correct answer: B

    ReadWriteMany allows many nodes to mount the volume for read and write, which requires a backend that supports it. ReadWriteOnce limits mounting to one node, and ReadOnlyOnce is not the standard mode for shared writes.

  6. Question 30

    A volume expansion is requested for a PersistentVolumeClaim. What must be true for the request to succeed?

    1. AThe StorageClass must allow volume expansion
    2. BThe pod must be deleted before resizing
    3. CThe node must be drained and rebooted
    4. DThe claim must be unbound from its pod
    Show answer and explanation
    Correct answer: A

    The StorageClass must set allowVolumeExpansion to true before a claim can be resized. Deleting pods, rebooting nodes and renaming claims are not requirements.

Want more CKA 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.