Explore / Exam Prep for the Certified Kubernetes Administrator (CKA) / Practice questions
Certified Kubernetes Administrator (CKA) practice questions
10 questions from the bank behind this course's timed mock. Free to read and to answer, no account needed, and each has its answer and an explanation. They belong to Exam Prep for the Certified Kubernetes Administrator (CKA).
Answer them one at a time →Read lesson 1 free
Question 1
You are a platform engineer halfway through the CKA exam. A task asks you to create an HTTPRoute, and you need to check the resource's field names. You want to stay within the exam rules. Which site may you open in the exam browser for this?
- Your personal study notes stored in a cloud document
- gateway-api.sigs.k8s.io
- github.com/kubernetes-sigs
- stackoverflow.com
Show the answer
Answer: B. gateway-api.sigs.k8s.io
gateway-api.sigs.k8s.io is one of the approved documentation sites, along with kubernetes.io/docs, kubernetes.io/blog and helm.sh/docs. The kubernetes-sigs GitHub organisation hosts real Kubernetes projects, but it is not on the approved list, so you may not open it during the exam.
Question 2
A cluster administrator is writing firewall rules for a new control plane node. The rules must allow the default inbound ports used by the kube-scheduler and the kube-controller-manager, and must not open anything else. Which TWO ports should the administrator allow? (Select TWO.)
More than one answer is right.
- TCP 10257
- TCP 10259
- TCP 10256
- TCP 6443
- TCP 10250
Show the answer
Answers: A. TCP 10257; B. TCP 10259
By default the kube-scheduler listens on TCP 10259 and the kube-controller-manager listens on TCP 10257. TCP 10250 is a real control plane port, but it belongs to the Kubelet API and is also needed on workers. 6443 is the API server and 10256 is kube-proxy, so neither meets the requirement.
Question 3
You are the cluster administrator on a kubeadm control plane node. You must back up etcd with etcdctl snapshot save. You have already set --endpoints and --cacert from /etc/kubernetes/manifests/etcd.yaml. Which pair of files should you pass to --cert and --key?
- /etc/kubernetes/pki/etcd/ca.crt and /etc/kubernetes/pki/etcd/ca.key
- /etc/kubernetes/pki/etcd/server.crt and /etc/kubernetes/pki/etcd/server.key
- /etc/kubernetes/pki/etcd/peer.crt and /etc/kubernetes/pki/etcd/peer.key
- /etc/kubernetes/admin.conf for both flags
Show the answer
Answer: B. /etc/kubernetes/pki/etcd/server.crt and /etc/kubernetes/pki/etcd/server.key
In the manifest, --cert-file and --key-file point to server.crt and server.key, and they map to the etcdctl --cert and --key flags. The peer.crt and peer.key files are close but wrong: they secure traffic between etcd members, not client connections.
Question 4
You are the cluster administrator. Deployment 'catalog' has 10 replicas and its strategy is RollingUpdate with the default maxSurge and maxUnavailable values. The capacity team asks what will happen during the next image update. What are the highest total Pod count and the lowest available Pod count the rollout allows?
- At most 13 Pods in total and at least 7 available
- At most 12 Pods in total and at least 8 available
- At most 13 Pods in total and at least 8 available
- At most 12 Pods in total and at least 7 available
Show the answer
Answer: C. At most 13 Pods in total and at least 8 available
Both settings default to 25%. 25% of 10 is 2.5. maxSurge rounds up to 3, which allows 13 Pods in total, and maxUnavailable rounds down to 2, which keeps at least 8 available. The answer '13 total, at least 7 available' rounds maxUnavailable up as well, which is wrong because maxUnavailable rounds down.
Question 5
You are checking a Pod before a node maintenance window. It has two containers. Container `app` sets `requests: {cpu: 250m, memory: 256Mi}` and `limits: {cpu: 250m, memory: 256Mi}`. Container `log-agent` sets no resources. The namespace has no LimitRange. You need to report which QoS class `kubectl get pod -o jsonpath='{.status.qosClass}'` returns. What is it?
- Guaranteed, because the only container with resources has requests equal to limits
- Burstable, because at least one container has a request or limit, but not every container has equal CPU and memory requests and limits
- BestEffort, because one container has no requests or limits
- Guaranteed for `app` and BestEffort for `log-agent`, because QoS is assigned per container
Show the answer
Answer: B. Burstable, because at least one container has a request or limit, but not every container has equal CPU and memory requests and limits
A Pod is Guaranteed only if every container has CPU and memory requests equal to its limits. Here one container has resources and the other has none, so the Pod is Burstable. BestEffort is wrong because it requires that no container has any request or limit, and QoS is a class for the whole Pod, not for each container.
Question 6
You are the cluster administrator. Service `web-svc` in namespace `default` selects three Pods. During a rollout, users report that some requests are slow, so you run `kubectl get endpointslice web-svc-x7k2p -o yaml`. One endpoint shows `conditions.ready: false` because its readiness probe is failing. You must explain to the team how that Pod is being treated right now. Which statement is correct?
- The Service stops sending traffic to all three Pods until every endpoint in the slice reports ready: true.
- kube-proxy keeps sending its share of traffic to the Pod, because readiness only affects `kubectl get pods` output.
- The EndpointSlice controller removes the Pod's address from the slice entirely, so it only shows up in the deprecated v1 Endpoints object.
- The Pod stays listed in the EndpointSlice with ready: false and gets no Service traffic until its readiness probe passes.
Show the answer
Answer: D. The Pod stays listed in the EndpointSlice with ready: false and gets no Service traffic until its readiness probe passes.
A Pod that fails its readiness probe stays in the EndpointSlice with ready: false and gets no traffic. The address is not removed from the slice, so checking `conditions.ready` is how you find this fault.
Question 7
You are a cluster administrator. A Service named `db` in namespace `prod` exposes a named TCP port called `mysql`. A client application must find both the port number and the target host through a DNS SRV lookup. Which name should the application query?
- _tcp._mysql.db.prod.svc.cluster.local
- mysql.tcp.db.prod.svc.cluster.local
- _mysql._tcp.db.prod.pod.cluster.local
- _mysql._tcp.db.prod.svc.cluster.local
Show the answer
Answer: D. _mysql._tcp.db.prod.svc.cluster.local
An SRV record for a named port uses the format `_<port>._<proto>.<svc>.<ns>.svc.cluster.local`, so the port name comes first, then the protocol, each with an underscore prefix. The `.pod.cluster.local` option is wrong because that zone holds Pod IP records, not Service SRV records.
Question 8
A platform engineer writes a StorageClass for a node-local provisioner and sets only metadata.name, provisioner and reclaimPolicy: Retain. A developer creates a PVC from this class, and it binds within seconds. The Pod that uses the claim has a nodeSelector for a different node, and it now cannot be scheduled. Which change to how the class is written would most directly have prevented this?
- Set volumeBindingMode: WaitForFirstConsumer so that the volume is provisioned only after the scheduler has picked a node for the Pod
- Add the annotation storageclass.kubernetes.io/is-default-class: "true" so that the scheduler takes the class into account
- Leave volumeBindingMode unset, because the default already waits for the first consumer
- Set reclaimPolicy: Delete so that the misplaced volume is removed and created again on the correct node
Show the answer
Answer: A. Set volumeBindingMode: WaitForFirstConsumer so that the volume is provisioned only after the scheduler has picked a node for the Pod
When volumeBindingMode is not set, it defaults to Immediate, so the volume was created before the scheduler had placed the Pod. WaitForFirstConsumer delays provisioning until after the scheduler has picked a node that meets the Pod's constraints. Leaving the field unset is the cause of the problem, not the fix.
Question 9
You are the administrator of a kubeadm cluster. Node worker-1 is NotReady, and the task says the fix must survive a reboot. On the node, `journalctl -u kubelet` shows `running with swap on is not supported, please disable swap`. Which action fixes the node and keeps it fixed?
- Run `swapoff -a`, remove the swap entry from `/etc/fstab`, then restart the kubelet
- Run `systemctl enable --now kubelet` so the kubelet starts again after a reboot
- Run `swapoff -a`, then restart the kubelet
- Set `failSwapOn: true` in `/var/lib/kubelet/config.yaml`, then restart the kubelet
Show the answer
Answer: A. Run `swapoff -a`, remove the swap entry from `/etc/fstab`, then restart the kubelet
`swapoff -a` turns swap off now, and removing the entry from `/etc/fstab` stops swap from coming back at boot. Running `swapoff -a` alone fixes the node only until the next reboot, so it does not meet the 'permanent' requirement. `failSwapOn: true` is already the default and is the reason the kubelet refuses to start.
Question 10
You are the on-call administrator for a cluster whose API server works normally. A busy container in Pod 'ingest-5c7d' wrote a stack trace about 40 minutes ago, but `kubectl logs ingest-5c7d` now shows only recent lines and the container has not restarted. The kubelet uses its default log rotation settings. What is the best way to get the earlier stack trace?
- Run `crictl ps` on the node, because the runtime keeps the full, unrotated log in memory
- Run `kubectl logs ingest-5c7d --previous` to read the earlier output
- SSH to the Pod's node and read the older rotated log files under /var/log/pods/<namespace>_ingest-5c7d_<uid>/<container>/
- Run `journalctl -u kubelet --since "1 hour ago"`, because the kubelet copies container output into the journal
Show the answer
Answer: C. SSH to the Pod's node and read the older rotated log files under /var/log/pods/<namespace>_ingest-5c7d_<uid>/<container>/
The kubelet rotates container logs (by default at 10Mi, keeping 5 files), and `kubectl logs` reads only the newest file, so the older output is still in the rotated files on disk. `--previous` returns the log of the container instance before the last restart, and this container has not restarted, so it does not help.
The full timed mock
50 questions in 75 minutes, with a pass mark of 66%. Each paper is drawn from a bank of questions written for the mock alone, and these 10 are left out of it. Full access opens it, with every level of the course.
LevelUpWith is independent of the organisation that sets this exam. These questions were written for this course; they are not taken from the exam.