Skip to content

CKA Practice Questions

Prepare for CKA with more than an answer.

199 questions in the full set20 sample questionsUpdated Aug 11, 2025
Exam fee
$445 USD
Questions on the exam
15-20 tasks
Passing score
66%
Level
Professional
Valid for
2 years
Domains covered on the exam 5
  1. Storage10%
  2. Workloads & Scheduling15%
  3. Services & Networking20%
  4. Troubleshooting30%
  5. Cluster Architecture, Installation & Configuration25%
  1. 1

    Workloads on a node named node-04 are reporting intermittent I/O errors, although the node is still Ready. Before you investigate, you want the scheduler to stop placing new pods on node-04, without evicting the pods that are already running there. Which command marks node-04 as unschedulable?

    Show answer details

    Correct answer: B

    kubectl cordon node-04 sets spec.unschedulable: true on the Node. The scheduler then places no new Pods there, while the existing Pods keep running; kubectl get nodes shows the node as Ready,SchedulingDisabled, and kubectl uncordon reverses it. kubectl drain also cordons the node but then evicts its Pods, which is not wanted yet. A custom NoSchedule taint only repels Pods that do not tolerate it and does not mark the node unschedulable. kubectl stop node is not a kubectl command.

  2. 2

    You need to schedule a batch job that runs a database cleanup script every day at 01:00 AM UTC. The job should use the db-cleanup:1.2 image. Which Kubernetes object is designed for this type of recurring task?

    Show answer details

    Correct answer: B

    A CronJob creates Jobs on a repeating schedule written in cron format (minute, hour, day of month, month, day of week), so "0 1 * * *" means 01:00 every day. Without .spec.timeZone, kube-controller-manager interprets the schedule in its own local time zone; set .spec.timeZone: "Etc/UTC" to make sure the job runs at 01:00 UTC. A Deployment or StatefulSet runs long-lived Pods, and a Job runs only once.

  3. 3

    When configuring a HorizontalPodAutoscaler (HPA) to scale on CPU or memory utilization, the resource metrics API (metrics.k8s.io), which is usually provided by the metrics-server add-on, must be available in the cluster. True or False?

    Show answer details

    Correct answer: A

    True. For CPU and memory utilization the HPA controller queries the resource metrics API (metrics.k8s.io), an aggregated API that is usually served by Metrics Server, an add-on that has to be deployed separately. Without an implementation of that API the HPA cannot read Pod usage and takes no scaling action. Custom and external metrics come from separate APIs (custom.metrics.k8s.io and external.metrics.k8s.io).

  4. 4

    A cluster is experiencing issues where containers in several pods are being killed with the reason OOMKilled whenever their node runs low on memory. An investigation reveals that these pods have no resources section defined in their manifests. In which Quality of Service (QoS) class are these pods running, and why does this make them the first candidates to be killed or evicted under node memory pressure?

    Show answer details

    Correct answer: A

    A Pod in which no container has CPU or memory requests or limits is in the BestEffort QoS class. When the node runs out of memory before the kubelet can reclaim it, the kernel OOM killer picks victims by oom_score. The kubelet gives BestEffort containers oom_score_adj 1000, the highest value (Guaranteed containers get -997), so they are killed first and report OOMKilled. For node-pressure eviction, the kubelet first ranks Pods whose usage exceeds their requests, then by Priority. A BestEffort Pod has no requests, so any usage exceeds them, and 'the kubelet prefers to evict BestEffort Pods'. An OOM kill is not an eviction: the container is terminated and can be restarted according to restartPolicy, whereas an evicted Pod ends in phase Failed with reason Evicted. Setting requests (and limits) moves these Pods to Burstable or Guaranteed.

  5. 5

    You are using Kustomize to manage deployments across different environments (staging and production). The base/ directory contains a standard Deployment manifest. You need to create a production/ overlay that increases the replica count to 5 and adds an annotation env: production. Which of the following kustomization.yaml files, placed in the production/ directory, would achieve this?

    Show answer details

    Correct answer: C

    This is the correct syntax for a Kustomize overlay. The resources field points to the base configuration. The replicas field is a special transformer that finds a resource by name and sets its replica count. commonAnnotations is another transformer that adds the specified annotation to all resources managed by this kustomization.

  6. 6

    You are hardening a high-availability cluster whose control plane nodes run stacked etcd. After inspecting the static pod manifests in /etc/kubernetes/manifests/, you notice the etcd pod definition is missing a critical parameter for secure communication between members. Which of the following parameters, when correctly configured, ensures that etcd members properly authenticate each other?

    Show answer details

    Correct answer: D

    --peer-client-cert-auth=true makes an etcd member check that every incoming peer request (port 2380) presents a valid client certificate signed by the peer CA (--peer-trusted-ca-file). The flag defaults to false, and the etcd docs recommend enabling it to block unauthenticated, forged peers. kubeadm sets it to true in the etcd static Pod, together with --peer-cert-file and --peer-key-file. --listen-client-urls and --advertise-client-urls concern client traffic on port 2379, and --initial-cluster-state (new or existing) only matters when a member bootstraps.

  7. 7

    A developer reports that their pod in the dev-ns namespace cannot resolve the service name db-service.prod-ns.svc.cluster.local, despite the service existing and being accessible from pods within the prod-ns namespace. You suspect a NetworkPolicy is interfering. Which of the following NetworkPolicy manifests is the most likely cause of this specific DNS resolution failure?

    Show answer details

    Correct answer: A

    When a NetworkPolicy selects Pods for egress, as a default deny-all egress policy in dev-ns does, those Pods may open only the connections that some egress rule allows. The docs caution that 'a default deny-all egress policy also blocks DNS traffic'. Queries from dev-ns Pods to the cluster DNS Service (CoreDNS in kube-system, UDP/TCP port 53) are therefore dropped, and even the FQDN db-service.prod-ns.svc.cluster.local cannot be resolved. The fix is an egress rule that allows port 53 to the CoreDNS Pods, for example namespaceSelector kubernetes.io/metadata.name: kube-system plus podSelector k8s-app: kube-dns. The other policies do not touch the lookup: ingress rules in prod-ns or on dev-ns Pods do not filter the outgoing DNS query, and an egress policy in prod-ns only affects Pods in prod-ns.

  8. 8

    You are performing a cluster upgrade from v1.32.5 to v1.33.1 using kubeadm. After successfully upgrading the first control plane node with kubeadm upgrade apply v1.33.1, you proceed to upgrade the worker nodes. The worker's apt source already points to the pkgs.k8s.io v1.33 repository (package index updated), and the Kubernetes packages are not on hold. What is the correct sequence of commands to safely upgrade a worker node named worker-01?

    Show answer details

    Correct answer: C

    Worker nodes are upgraded one at a time after the control plane. Drain the node (from a machine with an admin kubeconfig) and upgrade the kubeadm package. Then run kubeadm upgrade node; on a worker it fetches the kubeadm ClusterConfiguration and upgrades the node's kubelet configuration. Upgrade the kubelet and kubectl packages, restart the kubelet and uncordon the node. pkgs.k8s.io package versions look like 1.33.1-1.1, and the docs pin them as '1.33.x-*'. The v1.35 'Upgrading Linux nodes' page drains after kubeadm upgrade node and runs systemctl daemon-reload before restarting the kubelet; draining first is equally safe. The other sequences are wrong. Skipping the drain disrupts running workloads. Upgrading only the kubelet skips kubeadm upgrade node, so the node's kubelet configuration is not upgraded. kubeadm upgrade node runs on the node being upgraded; it cannot target a worker from a control plane node.

  9. 9

    A pod is in a CrashLoopBackOff state. Running kubectl logs --previous shows that the application terminated due to a failure to connect to a database. You need to gain interactive access to the pod's environment to test network connectivity using tools like ping and wget, but these tools are not included in the original container image. What is the most effective kubectl command to debug this issue?

    Show answer details

    Correct answer: D

    kubectl debug is built for this. kubectl exec needs a running container that already contains the tools, and here the container keeps crashing and lacks them. kubectl attach only connects to the existing process's streams, and port-forward tunnels traffic from your workstation. kubectl debug -it --image=busybox:1.28 --share-processes --copy-to=debug-pod creates a copy of the Pod named debug-pod with an extra busybox container (which provides ping, wget, nc and nslookup) and attaches to it. All containers in the copy share its network namespace, so you can test connectivity to the database from the application's network environment, and --share-processes lets you see the application's processes. The copy is a new Pod with its own IP and, unless you add --keep-labels, without the original labels. To debug inside the original Pod instead, add an ephemeral container with kubectl debug -it --image=busybox:1.28 --target= . Delete debug-pod when you are finished.

  10. 10

    You need to create a Kubernetes secret named db-credentials in the backend namespace to store a database username and password. The username is admin and the password is S3cur3P@ssw0rd!. Which imperative command correctly creates this secret directly from the command line, without first writing the credentials to a file?

    Show answer details

    Correct answer: C

    kubectl create secret generic with one --from-literal=key=value per key is the documented way to create a Secret from raw data. The password is wrapped in single quotes so that the shell does not interpret special characters such as ! or $. The second command stores the wrong password value (the echoed text password: S3cur3P@ssw0rd! plus a newline), kubectl create secret has no --username/--password flags and needs a subcommand such as generic, and --from-env-file needs a credentials file written beforehand. Values passed on the command line can end up in your shell history, so clear or avoid the history entry when handling real credentials.

Create an account to continue.