Explore / Exam Prep for the Kubernetes and Cloud Native Associate (KCNA) / Practice questions
Kubernetes and Cloud Native Associate (KCNA) 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 Kubernetes and Cloud Native Associate (KCNA).
Answer them one at a time →Read lesson 1 free
Question 1
A platform engineer uses a kind cluster that runs Kubernetes v1.30 as a study lab. Their laptop has several kubectl binaries installed, and they want to use a version that is supported against this cluster. Which kubectl versions are within the supported range? (Select TWO.)
More than one answer is right.
- kubectl v1.27
- kubectl v1.32
- kubectl v1.28
- kubectl v1.31
- kubectl v1.29
Show the answer
Answers: D. kubectl v1.31; E. kubectl v1.29
kubectl is supported within one minor version of the cluster, so a v1.30 cluster works with v1.29, v1.30 and v1.31. v1.28 and v1.32 are two minor versions away, which is outside the supported skew.
Question 2
A developer writes a Pod manifest with two containers: an nginx web server and a second image that also runs its own HTTP server on port 80. The goal is to run both servers in the same Pod without changing their ports. What is the main problem with this design?
- Containers in a Pod share one network namespace, so both cannot listen on port 80
- The scheduler may place the two containers on different nodes, so port 80 cannot be reached
- Each container gets its own IP address, so clients cannot know which one to call
- A Pod can define only one container that declares a containerPort
Show the answer
Answer: A. Containers in a Pod share one network namespace, so both cannot listen on port 80
All containers in a Pod share one network namespace and one IP, so two of them cannot bind the same port. The claim about separate IPs is wrong because the whole Pod has a single IP that every container shares.
Question 3
A developer deploys a Pod into the Namespace "payments". Its manifest uses a configMapKeyRef that points to a ConfigMap called "app-config". That ConfigMap exists only in the Namespace "shared". The developer wants the Pod to start with the correct value. What is the best fix?
- Convert the ConfigMap into a Secret, because Secrets can be shared across Namespaces
- Create the "app-config" ConfigMap in the "payments" Namespace, because a Pod can only use ConfigMaps from its own Namespace
- Add the prefix "shared/" to the ConfigMap name in the configMapKeyRef so the Pod can reach the other Namespace
- Mount the ConfigMap as a volume instead of an environment variable, because volumes are not limited to one Namespace
Show the answer
Answer: B. Create the "app-config" ConfigMap in the "payments" Namespace, because a Pod can only use ConfigMaps from its own Namespace
ConfigMaps and Secrets are namespaced, so the Pod needs a ConfigMap in its own Namespace. Switching to a volume does not help, because volumes have the same Namespace limit as environment variables.
Question 4
A platform engineer is watching a Pod be placed in a 5-node cluster. After filtering, 3 nodes are feasible. After scoring, two of them share the same highest score. The engineer wants to predict where the Pod will land. What will kube-scheduler do?
- Pick one of the top-scoring nodes at random
- Hand both nodes to the kubelet, which chooses the one with less load
- Leave the Pod Pending until one node scores higher than the other
- Pick the top-scoring node whose name comes first alphabetically
Show the answer
Answer: A. Pick one of the top-scoring nodes at random
When several feasible nodes share the highest score, kube-scheduler picks one of them at random. The Pod does not stay Pending, because Pending only happens when filtering leaves no feasible node at all.
Question 5
A platform engineer reviews a Deployment whose container spec reads `image: registry.example.com/team/api:latest@sha256:9f86d081...` and has no imagePullPolicy field. Which pull policy will Kubernetes set when the Pod is created, and which image will run?
- Always, and the image identified by the digest runs
- IfNotPresent, and the image identified by the digest runs
- Always, and the image currently tagged latest runs
- IfNotPresent, and the image currently tagged latest runs
Show the answer
Answer: B. IfNotPresent, and the image identified by the digest runs
Kubernetes checks the defaulting rules in order, and the first rule (a digest is present) gives IfNotPresent. When a tag and a digest are both given, the digest wins. 'Always' is the nearest distractor: it would apply only if the reference had no digest and used :latest or no tag.
Question 6
A cluster operator has installed two Ingress controllers, each with its own IngressClass. One of the IngressClasses is marked as the cluster default. A developer creates an Ingress and leaves out the `ingressClassName` field. Which controller handles this Ingress?
- Neither controller, because `ingressClassName` is required and the API server rejects the Ingress
- Whichever controller was installed first in the cluster
- Both controllers, each adding its own address to the ADDRESS column
- The controller whose IngressClass is the cluster's default IngressClass
Show the answer
Answer: D. The controller whose IngressClass is the cluster's default IngressClass
Each controller handles only the Ingresses whose `ingressClassName` matches its IngressClass, and when the field is left out the cluster's default IngressClass is used. The API server does not reject the Ingress, and both controllers do not handle it at the same time; the default class decides which one does.
Question 7
A platform engineer manages a busy namespace. The compliance team wants every new Pod that breaks the Restricted Pod Security Standard to be recorded in the API server audit log. Developers must not be blocked, and they must not see any new kubectl warnings. Which namespace label meets this goal?
- pod-security.kubernetes.io/warn=restricted
- pod-security.kubernetes.io/enforce=restricted
- pod-security.kubernetes.io/audit-version=restricted
- pod-security.kubernetes.io/audit=restricted
Show the answer
Answer: D. pod-security.kubernetes.io/audit=restricted
The audit mode lets the Pod through and adds an annotation to the API server audit log. It does not show the user anything and does not reject the Pod. The warn mode also lets the Pod through, but it shows a warning in kubectl output, which the developers must not see. The -version label only pins a policy version such as v1.34 or latest; it does not set a level.
Question 8
A developer runs a Deployment with 2 replicas. Both replicas mount the same PVC, which has the access mode ReadWriteOnce. The scheduler places both Pods on the same worker node. What is the expected result?
- Kubernetes automatically converts the claim to ReadWriteOncePod and rejects the second Pod
- Both Pods can mount the volume read-write, because ReadWriteOnce is enforced per node, not per Pod
- The second Pod stays in ContainerCreating until the first Pod releases the volume
- The second Pod mounts the volume read-only, because ReadWriteOnce allows only one writer
Show the answer
Answer: B. Both Pods can mount the volume read-write, because ReadWriteOnce is enforced per node, not per Pod
ReadWriteOnce limits read-write mounting to one node, so several Pods on that node can share the volume. The 'one writer' behaviour in the distractors belongs to ReadWriteOncePod, which you must request explicitly and which works only with CSI volumes.
Question 9
A platform engineer reviews a team's GitOps repository. Every Deployment manifest uses the image tag `myapp:latest`, and CI pushes a new image under that same tag on each build. The audit must show that the team can return the cluster to any known earlier state. Which GitOps principle does this setup break most directly?
- Versioned and immutable, because the Git history no longer identifies which image was actually running
- Continuously reconciled, because the agent cannot detect drift in a Deployment that uses the latest tag
- Declarative, because image tags make the manifests a list of commands
- Pulled automatically, because a floating tag forces the CI system to push the image into the cluster
Show the answer
Answer: A. Versioned and immutable, because the Git history no longer identifies which image was actually running
A floating `latest` tag means a commit in Git no longer points to one fixed image, so you cannot roll back to a known state. That breaks the versioned and immutable principle. The manifests are still declarative, because they describe what the system should look like, so the Declarative option is wrong.
Question 10
A platform engineer has added the OpenTelemetry SDK to three microservices: frontend, cart and payment. All three export spans to the same Collector, which forwards them to Jaeger. One checkout request should appear in Jaeger as a single trace. Instead, Jaeger shows three separate traces, each with its own trace ID, and each trace holds only one service's spans. What is the most likely cause?
- The batch processor in the Collector splits each request's spans into separate traces to keep payloads small
- The Collector pipeline lists exporters before receivers, so spans reach Jaeger out of order and are split up
- Jaeger cannot link spans from different services unless each service sends them to its own Jaeger instance
- Trace context is not being propagated between services, so each service starts a new root span instead of reading the incoming W3C traceparent header
Show the answer
Answer: D. Trace context is not being propagated between services, so each service starts a new root span instead of reading the incoming W3C traceparent header
Spans join one trace only when the trace ID and parent span ID travel with the request, usually in the traceparent header. Without that, each service creates its own root span and a new trace ID. Pipeline order is fixed by the Collector as receivers → processors → exporters, and batching groups spans for export without changing their trace IDs.
The full timed mock
60 questions in 90 minutes, with a pass mark of 75%. 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.