Courseiva

Certified Kubernetes Administrator CKA (CKA) — Questions 526–600

726 questions total · 10pages · All types, answers revealed

Page 7

Page 8 of 10

Page 9
526
Multi-Selecthard

Which THREE of the following are characteristics of a StatefulSet's volumeClaimTemplates?

Select 3 answers
A.When a Pod is deleted, the corresponding PVC is automatically deleted.
B.The PVCs are created in the same namespace as the StatefulSet.
C.Each PVC gets a unique name derived from the template name and the Pod ordinal.
D.They are used to automatically create PersistentVolumeClaims for each replica.
E.The volumeClaimTemplate must specify a storageClassName.
AnswersB, C, D

PersistentVolumeClaims are namespace-scoped objects, just like StatefulSets, Pods, and Services. When a StatefulSet defines volumeClaimTemplates, the StatefulSet controller creates the resulting PVCs in the same namespace in which the StatefulSet itself is created, ensuring that Pods and their volumes exist in the same Kubernetes namespace. This namespace isolation is a fundamental part of Kubernetes identity and access control: PVs are cluster-scoped, but PVCs cannot cross namespaces, and a Pod can only mount a PVC from its own namespace. Consequently, the PVCs are inevitably co-located with the StatefulSet.

Why this answer

Option B is correct because volumeClaimTemplates generate PersistentVolumeClaims within the same namespace as the owning StatefulSet, since PVCs are namespaced resources and cannot cross namespace boundaries. Option C is correct because each generated PVC follows the naming convention <template-name>-<statefulset-name>-<ordinal>, giving every replica a unique, stable PVC tied to its Pod ordinal. Option D is correct because the core purpose of volumeClaimTemplates is to automatically provision a PersistentVolumeClaim for each StatefulSet replica, ensuring stable per-Pod storage.

Option A is not correct because StatefulSet PVCs are retained by default when a Pod is deleted (only scale-down or deletion with the right policy may remove them), so automatic deletion is not a characteristic. Option E is not correct because storageClassName is optional in a volumeClaimTemplate; if omitted, the cluster's default StorageClass is used.

Exam trap

The trap here is that candidates often assume PVCs are ephemeral like Pods, but StatefulSets intentionally preserve PVCs to guarantee data persistence across Pod lifecycle events.

527
MCQhard

A Kubernetes cluster has been running for months. Recently, some pods are reporting 'FailedScheduling' due to insufficient memory. The administrator wants to add a new node with 32GB RAM. However, after joining the node, the new node shows 'NotReady' and the kubelet logs indicate 'Failed to update node status: context deadline exceeded'. What is the most likely cause?

A.The kubelet is not configured with the correct node IP.
B.The new node does not have enough disk space for container images.
C.There is a network connectivity issue between the new node and the control plane.
D.The API server is overloaded and cannot handle the node update request.
AnswerC

A 'context deadline exceeded' error explicitly indicates that a gRPC or HTTP request timed out before receiving a response. In this scenario, network latency, packet loss, or misconfigured firewalls/security groups between the new node and the control plane prevent the kubelet from successfully posting its lease updates to the API server within the allocated timeframe.

Why this answer

The 'context deadline exceeded' error in the kubelet logs indicates that the kubelet on the new node is unable to communicate with the API server within the expected timeout. This is typically caused by network connectivity issues between the node and the control plane, such as firewall rules, incorrect DNS resolution, or a broken CNI plugin. Without successful node-to-API-server communication, the kubelet cannot post its status, leaving the node in 'NotReady' state.

Exam trap

The trap here is that candidates often confuse 'context deadline exceeded' with a resource exhaustion issue (like disk or memory) or a kubelet configuration error, when in fact it is a classic symptom of network connectivity failure between the node and the control plane.

How to eliminate wrong answers

Option A is wrong because an incorrect node IP would cause the kubelet to bind to the wrong interface, but the error 'context deadline exceeded' specifically points to a timeout in reaching the API server, not a local binding issue. Option B is wrong because insufficient disk space for container images would manifest as image pull failures or eviction, not as a kubelet status update timeout. Option D is wrong because an overloaded API server would affect all nodes and clients, not just a single new node, and the error message is specific to the kubelet's update request timing out, not a server-side rejection.

528
MCQmedium

You have a Deployment with 4 replicas. During a rolling update, you want to ensure that only 2 pods are unavailable at any given time. Which field should you set in the Deployment spec?

A.spec.strategy.rollingUpdate.maxUnavailable
B.spec.updateStrategy.rollingUpdate.maxUnavailable
C.spec.replicas.maxUnavailable
D.spec.strategy.rollingUpdate.maxSurge
AnswerA

This is the correct field path for defining rolling update behavior in a Kubernetes Deployment. By setting spec.strategy.rollingUpdate.maxUnavailable to 2, you guarantee that at least 2 pods (out of the 4 desired replicas) remain active and available to serve traffic at any given point during the rolling update process.

Why this answer

The `spec.strategy.rollingUpdate.maxUnavailable` field specifies the maximum number of Pods that can be unavailable during a rolling update. Setting it to 2 ensures that at most 2 replicas are unavailable at any given time, which aligns with the requirement of having 4 replicas and allowing only 2 unavailable pods.

Exam trap

The trap here is confusing `maxUnavailable` with `maxSurge`; candidates often pick `maxSurge` thinking it controls unavailability, but it actually controls how many extra Pods can be created above the replica count during an update.

How to eliminate wrong answers

Option B is wrong because the correct path is `spec.strategy.rollingUpdate.maxUnavailable`, not `spec.updateStrategy.rollingUpdate.maxUnavailable`; the `updateStrategy` field does not exist in the Deployment spec. Option C is wrong because `spec.replicas` is an integer specifying the desired number of replicas, not a field that accepts a subfield like `maxUnavailable`. Option D is wrong because `spec.strategy.rollingUpdate.maxSurge` controls the maximum number of Pods that can be created above the desired replicas during an update, not the number of unavailable Pods.

529
MCQeasy

Which of the following is a valid CSI (Container Storage Interface) driver operation in Kubernetes?

A.CreateVolume
B.CreateDeployment
C.CreateService
D.CreatePod
AnswerA

CreateVolume is a core gRPC method defined in the Container Storage Interface (CSI) Controller service specification. It is invoked by the Kubernetes external-provisioner sidecar to provision a new physical or virtual storage volume on the underlying storage provider before it can be attached to a node.

Why this answer

The Container Storage Interface (CSI) defines a set of standard operations that storage drivers must implement to provision, attach, mount, and manage volumes in container orchestrators like Kubernetes. `CreateVolume` is a core CSI RPC (Remote Procedure Call) that the CSI driver must support to dynamically create a new storage volume, which is then used by Kubernetes to satisfy a PersistentVolumeClaim. This operation is defined in the CSI specification and is essential for dynamic volume provisioning.

Exam trap

The trap here is that candidates confuse Kubernetes API resource operations (like creating a Pod or Service) with the low-level CSI driver RPCs, which are not directly exposed as kubectl commands but are internal gRPC calls between Kubernetes components and the driver.

How to eliminate wrong answers

Option B (CreateDeployment) is wrong because it is a Kubernetes API object for managing replicated pods, not a CSI driver operation. Option C (CreateService) is wrong because it is a Kubernetes abstraction for network access to pods, not a storage-related CSI operation. Option D (CreatePod) is wrong because it is a Kubernetes primitive for running containers, and pod creation does not involve a CSI driver RPC; CSI operations are invoked by the kubelet or external provisioner, not directly by creating a pod.

530
MCQeasy

A developer accidentally runs 'kubectl delete pvc data-claim'. What is the immediate effect on the PersistentVolume pv-data?

A.The PV pv-data is automatically deleted.
B.The PV pv-data remains Bound to the deleted PVC.
C.The PV pv-data immediately becomes Available and can be reused.
D.The PV pv-data enters the Released state and is not deleted.
AnswerD

With the Retain reclaim policy configured, deleting the bound PVC causes the PV to enter the Released state rather than being deleted or recycled. This means the PV still exists and its underlying storage resources—such as disk data—remain intact, but it is no longer bound to any claim. The PV will remain in Released status until an administrator manually intervenes, typically by deleting the PV and recreating it or by editing its claimRef to allow rebinding. This preserves data for recovery but leaves the PV unused until explicit manual action is taken.

Why this answer

When a PVC is deleted, the associated PV enters the 'Released' state, not 'Available'. This is because the PV still contains data from the previous claim (the retain policy is 'Retain' by default), and Kubernetes does not automatically delete or reuse it. The PV remains in 'Released' until an administrator manually clears the claimRef or deletes the PV.

Exam trap

The trap here is that candidates assume the PV's reclaim policy is 'Delete' by default, or that deleting a PVC automatically makes the PV 'Available' for reuse, when in fact the default policy is 'Retain' and the PV enters 'Released'.

How to eliminate wrong answers

Option A is wrong because the PV is not automatically deleted when the PVC is deleted; the PV's lifecycle is independent and depends on its reclaim policy (default is 'Retain'). Option B is wrong because the PV does not remain 'Bound' to the deleted PVC; the binding is removed, and the PV transitions to 'Released'. Option C is wrong because the PV does not immediately become 'Available'; it enters 'Released' and cannot be reused until the claimRef is manually cleared by an administrator.

531
Multi-Selectmedium

Which THREE statements about StorageClasses are true?

Select 3 answers
A.Only cluster administrators can create StorageClasses.
B.StorageClasses are namespaced resources.
C.A StorageClass can specify a provisioner to enable dynamic volume provisioning.
D.The volumeBindingMode in a StorageClass can be set to 'WaitForFirstConsumer' to delay PV creation until a pod uses the PVC.
E.A StorageClass can set the reclaim policy for dynamically provisioned PVs.
AnswersC, D, E

A StorageClass's 'provisioner' field specifies the volume plugin responsible for dynamically provisioning PersistentVolumes. For example, 'kubernetes.io/aws-ebs' or 'pd.csi.storage-gke.io' causes the in-tree or CSI driver to create a new storage volume when a PVC references this StorageClass. Without a provisioner, a StorageClass cannot dynamically create PVs and is generally only useful for binding pre-existing PVs.

Why this answer

Option C is correct because a StorageClass defines a provisioner field (for example, kubernetes.io/aws-ebs or a CSI driver name) that tells Kubernetes which plugin should dynamically provision PersistentVolumes when a matching PVC is created. Option D is correct because setting volumeBindingMode: WaitForFirstConsumer defers both PV provisioning and binding until a pod that uses the PVC is scheduled, which allows topology-aware scheduling decisions. Option E is correct because the reclaimPolicy field in a StorageClass (values such as Delete or Retain) sets the reclaim policy applied to PVs that are dynamically provisioned by that class.

Option A is not correct because creating StorageClasses is governed by RBAC, not restricted to cluster administrators; any subject granted the appropriate permissions on the storageclasses resource can create them. Option B is not correct because StorageClasses are cluster-scoped resources, not namespaced, and are referenced by PVCs across namespaces.

Exam trap

The trap here is that candidates often confuse StorageClasses as namespaced resources (like PVCs) or assume only admins can create them, when in fact StorageClasses are cluster-scoped and RBAC-controlled, and the question tests precise knowledge of their configurable fields.

532
MCQeasy

A user reports that a pod is stuck in 'ContainerCreating' state. Which command would you run first to diagnose the issue?

A.kubectl logs <pod-name>
B.kubectl describe pod <pod-name>
C.kubectl get events --watch
D.kubectl exec -it <pod-name> -- /bin/sh
AnswerB

kubectl describe pod is the correct diagnostic because it displays the pod's status, conditions, container states, and a list of recent Events aggregated for that pod. These Events will contain specific errors such as FailedCreatePodSandBox, ErrImagePull, FailedMount, or CreateContainerError, along with the underlying message from the kubelet or container runtime. This gives you exactly the information needed to resolve ContainerCreating.

Why this answer

The 'ContainerCreating' state indicates the pod has been scheduled but the container runtime is failing to start the container. `kubectl describe pod` provides detailed events, status conditions, and error messages from the kubelet, such as image pull failures, volume mount errors, or CNI plugin issues, which are the most direct source of diagnostic information for this state.

Exam trap

The trap here is that candidates often jump to `kubectl logs` thinking it shows startup errors, but logs are only available after the container's entrypoint has executed, not during container creation failures.

Why the other options are wrong

A

Logs require a running container; the pod is still ContainerCreating, so no logs exist.

C

This shows all cluster events, not specifically the pod's issue; it's less direct than describe pod.

D

Exec requires a running container; pod is not running.

533
MCQeasy

You have multiple kubeconfig files. Which command merges them into a single config file?

A.kubectl config merge config1 config2 > merged-config
B.KUBECONFIG=config1:config2 kubectl config view --flatten > merged-config
C.cat config1 config2 > merged-config && kubectl config use-context merged-config
D.kubectl merge-config config1 config2
AnswerB

The KUBECONFIG environment variable accepts a colon-separated list of kubeconfig paths; with it set, kubectl loads and merges all listed files according to its precedence rules. kubectl config view outputs that merged in-memory configuration, and --flatten expands any file references (such as certificate-authority or client-key) into their base64-encoded inline data, producing a portable, self-contained kubeconfig. Redirecting the output into a file captures that single merged configuration.

Why this answer

The `KUBECONFIG` environment variable can accept a colon-separated list of kubeconfig files, and `kubectl config view --flatten` merges them into a single configuration, outputting the combined result to stdout, which can be redirected to a new file. This is the standard method for merging multiple kubeconfig files in Kubernetes.

Exam trap

The trap here is that candidates may assume a direct `kubectl` subcommand like `merge` exists, or that simple file concatenation works, but the CKA exam tests knowledge of the environment variable-based merge method as the only correct approach.

How to eliminate wrong answers

Option A is wrong because `kubectl config merge` is not a valid kubectl command; the correct approach uses `KUBECONFIG` and `kubectl config view --flatten`. Option C is wrong because simply concatenating config files with `cat` does not properly merge contexts, clusters, and users; it produces a malformed YAML file, and `kubectl config use-context` does not perform merging. Option D is wrong because `kubectl merge-config` is not a valid kubectl subcommand; no such command exists in the Kubernetes CLI.

534
MCQeasy

You want to check the memory usage of nodes in your cluster. Which command should you use?

A.kubectl top nodes
B.kubectl describe nodes
C.kubectl get nodes -o wide
D.kubectl get --raw /api/v1/nodes
AnswerA

kubectl top nodes queries the Metrics API (typically provided by metrics-server) to display the current CPU and memory usage for every node in the cluster. It reports actual consumption values, such as 82% memory, making it the correct command for checking real-time memory usage.

Why this answer

`kubectl top nodes` directly queries the metrics-server (or Heapster) to retrieve real-time CPU and memory usage data for all nodes in the cluster. This command relies on the resource metrics pipeline, which collects metrics from kubelet's cAdvisor endpoint and exposes them via the metrics API, making it the standard way to check node-level memory utilization.

Exam trap

The trap here is that candidates often confuse `kubectl describe nodes` (which shows allocatable memory) with actual memory usage, or they think the raw API or `-o wide` will include live metrics, but neither provides the real-time utilization data that `kubectl top` does.

How to eliminate wrong answers

Option B is wrong because `kubectl describe nodes` shows node conditions, capacity, allocatable resources, and pod summaries, but it does not display current memory usage; it only shows static capacity and allocatable values. Option C is wrong because `kubectl get nodes -o wide` adds extra columns like internal IP and OS image, but it does not include any memory usage metrics. Option D is wrong because `kubectl get --raw /api/v1/nodes` returns the raw Kubernetes API object for nodes, which contains spec and status fields like capacity and allocatable, but not live memory usage; it bypasses the metrics API entirely.

535
Multi-Selecteasy

Which TWO of the following are valid commands to check the status of control plane components?

Select 2 answers
A.systemctl status kube-apiserver
B.kubectl get nodes
C.kubectl get pods -n kube-system
D.kubectl get events --all-namespaces
E.kubectl top nodes
AnswersA, C

On clusters where control plane components are managed by systemd (e.g., packaged Kubernetes distributions or those set up with kubeadm before static pods became the default), `systemctl status kube-apiserver` queries the service manager for the exact process state, reporting whether the service is active, running, or failed. It also surfaces recent journal logs, making it a direct and authoritative check of the kube-apiserver service. However, this command is only valid when the component actually runs as a systemd unit; on clusters using static pods, it would return an error, so it is environment-specific but nonetheless a correct approach for systemd-based clusters.

Why this answer

`systemctl status kube-apiserver` directly queries the systemd service manager for the status of the kube-apiserver process, which is a core control plane component. Option C is correct because `kubectl get pods -n kube-system` lists all pods in the kube-system namespace, which includes control plane components like etcd, kube-scheduler, and kube-controller-manager when they run as static pods or Deployments. Both commands provide direct visibility into the health of control plane components.

Exam trap

The CKA exam often tests the distinction between commands that check node-level health versus component-level health, trapping candidates who confuse `kubectl get nodes` (node status) with direct control plane component checks.

536
MCQhard

You have a NetworkPolicy that denies all ingress traffic by default, and you want to allow traffic only from pods with label 'app: monitoring' in the same namespace. What should the policy spec look like?

A.ingress: - from: - ipBlock: cidr: 0.0.0.0/0
B.ingress: - from: - podSelector: matchLabels: app: monitoring - namespaceSelector: matchLabels: name: my-namespace
C.ingress: - from: - podSelector: matchLabels: app: monitoring
D.ingress: - from: - namespaceSelector: matchLabels: app: monitoring
AnswerC

This is the correct configuration because omitting the namespaceSelector entirely defaults the scope of the podSelector to the same namespace where the NetworkPolicy is applied. It successfully permits ingress traffic exclusively from pods labeled app: monitoring within the local namespace. This precisely satisfies the requirement of isolating traffic to specific local pods while maintaining the default-deny rule for everything else.

Why this answer

A NetworkPolicy with an ingress rule using only a podSelector allows traffic from pods matching the specified labels within the same namespace. Since the default policy denies all ingress traffic, this rule explicitly permits traffic from pods labeled 'app: monitoring' in the same namespace, which satisfies the requirement.

Exam trap

The trap here is that candidates often add a namespaceSelector unnecessarily, thinking it is required to restrict to the same namespace, when in fact omitting the namespaceSelector automatically limits the rule to the policy's namespace.

How to eliminate wrong answers

Option A is wrong because an ipBlock rule with 0.0.0.0/0 would allow traffic from all IP addresses, which contradicts the requirement to restrict traffic to only pods with label 'app: monitoring'. Option B is wrong because it includes a namespaceSelector, which would allow traffic from pods with label 'app: monitoring' in any namespace matching the namespace label 'name: my-namespace', not just the same namespace. Option D is wrong because it uses only a namespaceSelector, which would allow traffic from all pods in namespaces with label 'app: monitoring', regardless of pod labels, thus not restricting to pods with label 'app: monitoring'.

537
MCQmedium

An administrator runs 'kubectl get nodes' and sees that a worker node is in the 'Ready,SchedulingDisabled' state. Which command was most likely executed on that node?

A.kubectl drain node01
B.kubectl taint nodes node01 key=value:NoSchedule
C.kubectl cordon node01
D.kubectl uncordon node01
AnswerC

kubectl cordon node01 sets the node's unschedulable field to true, which causes the node to be marked as SchedulingDisabled in the output of kubectl get nodes. This prevents new pods from being scheduled onto the node while leaving all existing pods running, making it the safe and targeted way to remove a node from usage without disruption. The node remains fully Ready and can be re-enabled later with kubectl uncordon.

Why this answer

The 'Ready,SchedulingDisabled' state indicates the node has been marked as unschedulable using the 'kubectl cordon' command. Cordon marks the node as unschedulable, preventing new pods from being scheduled onto it while existing pods continue running. This matches the observed state exactly.

Exam trap

The trap here is confusing 'cordon' with 'drain' — candidates often think 'drain' is required to see 'SchedulingDisabled', but 'cordon' alone produces that state without evicting pods.

How to eliminate wrong answers

Option A is wrong because 'kubectl drain' evicts all pods from the node and then marks it as unschedulable, resulting in a 'Ready,SchedulingDisabled' state only after pod eviction, but the question asks for the command that most likely produced the state without specifying pod eviction. Option B is wrong because 'kubectl taint' with 'NoSchedule' prevents scheduling based on tolerations but does not change the node's scheduling status to 'SchedulingDisabled'; the node would remain 'Ready' without the disabled suffix. Option D is wrong because 'kubectl uncordon' reverses the cordon effect, making the node schedulable again, which would show 'Ready' without 'SchedulingDisabled'.

538
MCQmedium

You deploy a pod with resource limits but no requests. The pod gets OOMKilled. What is the most likely reason?

A.The pod's liveness probe is failing
B.The container's entrypoint command is invalid
C.The container tried to use more memory than the limit
D.The node does not have enough memory for the limit
AnswerC

When a container's memory usage exceeds its cgroup memory limit, the kernel's OOM killer terminates the container process, and kubelet records the reason as OOMKilled. Even with no explicit request, the limit is enforced as a hard cap, so the container is killed precisely for trying to allocate more memory than that cap. This is the only condition that sets the OOMKilled termination reason.

Why this answer

When a pod has a memory limit set but no memory request, the Linux kernel enforces the limit via cgroups. If the container's processes attempt to allocate more memory than the limit, the kernel's Out-Of-Memory (OOM) killer terminates the container, resulting in an OOMKilled status. This is the most direct cause of the OOMKilled event.

Exam trap

The trap here is that candidates often confuse OOMKilled with resource scheduling issues (Option D) or probe failures (Option A), but OOMKilled specifically indicates the container was terminated by the kernel for exceeding its memory limit, not for node-level insufficiency or health check failures.

How to eliminate wrong answers

Option A is wrong because a failing liveness probe would cause the pod to be restarted due to probe failure, not an OOMKill; the pod status would show 'CrashLoopBackOff' or 'Error', not OOMKilled. Option B is wrong because an invalid entrypoint command would prevent the container from starting at all, resulting in a 'CrashLoopBackOff' or 'Init:Error' status, not an OOMKilled termination after the container had been running. Option D is wrong because if the node lacks enough memory for the limit, the pod would remain in 'Pending' state with an 'Insufficient memory' scheduling failure, not be OOMKilled after running.

539
MCQhard

A Deployment's pod is stuck in Pending state. 'kubectl describe pod' shows Events: '0/4 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/control-plane: }, that the pod didn't tolerate, 3 Insufficient memory'. What is the likely fix?

A.Increase the memory limit of the pod or add more worker nodes
B.Remove the taint from the control-plane node
C.Add a toleration for the control-plane taint to the pod spec
D.Set nodeSelector to schedule on control-plane nodes
AnswerA

Why this answer

The error '3 Insufficient memory' indicates that three worker nodes lack the required memory to schedule the pod. Increasing the pod's memory limit (if it's set too high) or adding more worker nodes directly addresses the resource shortage. The control-plane node's taint is irrelevant because the pod is not trying to schedule there; the issue is insufficient memory on the available worker nodes.

Exam trap

The trap here is that candidates focus on the taint error and assume the control-plane node is the bottleneck, ignoring the more critical 'Insufficient memory' message that points to a resource shortage on the worker nodes.

How to eliminate wrong answers

Option B is wrong because removing the taint from the control-plane node does not solve the memory shortage on the three worker nodes; it only makes the control-plane node schedulable, but that node also has a taint that the pod does not tolerate, so it would still be unavailable unless a toleration is added. Option C is wrong because adding a toleration for the control-plane taint would allow the pod to schedule on the control-plane node, but that node also has insufficient memory (as implied by '0/4 nodes are available'), so it would not fix the pending state. Option D is wrong because setting nodeSelector to control-plane nodes would force scheduling on a node that is tainted and likely has insufficient memory, and the pod does not tolerate the taint, so it would remain pending.

540
Multi-Selecthard

Which THREE components are part of the Gateway API resource model? (Select THREE)

Select 3 answers
A.Gateway
B.GatewayClass
C.LoadBalancer
D.HTTPRoute
E.Ingress
AnswersA, B, D

Gateway is a core Gateway API resource, representing a specific load-balancing instance that defines listeners, protocols and TLS settings, and binds routes to underlying infrastructure. It sits alongside GatewayClass and HTTPRoute in the role-oriented model.

Why this answer

The Gateway API resource model is built around three primary role-oriented resources: GatewayClass, Gateway, and Route objects such as HTTPRoute. Option B (GatewayClass) is correct because it defines a cluster-scoped template that identifies the controller implementing the gateway, analogous to an IngressClass but for the Gateway API. Option A (Gateway) is correct because it represents a specific instance of infrastructure (a load balancer or proxy) provisioned by a GatewayClass controller, and it defines listeners for protocols like HTTP, HTTPS, or TLS.

Option D (HTTPRoute) is correct because Route resources attach to a Gateway's listeners and specify how traffic is matched and forwarded to backend Services, with HTTPRoute being the HTTP/HTTPS-specific route type. Option C (LoadBalancer) is not part of the Gateway API resource model; it is a Kubernetes Service type (spec.type: LoadBalancer) used for exposing workloads, not a Gateway API kind. Option E (Ingress) is the older, separate Kubernetes API for HTTP routing and is not a Gateway API resource, though Gateway API is designed as its successor.

Exam trap

The CKA exam often tests the distinction between the older Ingress API and the newer Gateway API, and candidates mistakenly select Ingress as a component of Gateway API, when in fact Gateway API is a separate, more expressive API family that includes GatewayClass, Gateway, and route resources like HTTPRoute.

541
MCQmedium

A pod with an init container that runs a database migration fails. The init container exits with code 1. What is the pod's status?

A.Init:CrashLoopBackOff
B.Pending
C.Failed
D.Running
AnswerA

When an init container fails (e.g., exits with a non-zero status code), Kubernetes will restart it according to its restart policy. If it repeatedly fails, Kubernetes applies an exponential back-off delay between restart attempts. This continuous cycle of starting, failing, and backing off is precisely what the "Init:CrashLoopBackOff" status indicates for an init container, preventing the main application containers from ever starting.

Why this answer

When an init container exits with a non-zero exit code (code 1), Kubernetes considers the init container to have failed. By default, the pod restarts the init container according to the pod's restart policy (which defaults to Always for pods, but init containers always restart on failure regardless of the pod's restart policy). This repeated failure and restart cycle places the pod in the Init:CrashLoopBackOff status, indicating that the init container is crashing in a loop.

Exam trap

The trap here is that candidates confuse the pod phase (Pending, Running, Failed) with the detailed pod status condition (Init:CrashLoopBackOff), and mistakenly choose 'Failed' thinking the init container failure ends the pod, not realizing Kubernetes will retry the init container automatically.

How to eliminate wrong answers

Option B (Pending) is wrong because the pod has already started executing its init containers; it is not stuck waiting for scheduling or image pull. Option C (Failed) is wrong because a pod enters the Failed phase only when all its containers have terminated and the pod will not be restarted (e.g., a non-init container with restart policy Never), but here the init container will be retried. Option D (Running) is wrong because the pod's init container has not completed successfully, so the pod's status cannot be Running; the pod remains in a waiting state until all init containers succeed.

542
MCQhard

A cluster administrator is configuring a Pod to use a PersistentVolumeClaim (PVC) that is dynamically provisioned using a StorageClass with volumeBindingMode: WaitForFirstConsumer. The PVC is created before the Pod. When the Pod is created, which node will the PV be provisioned on?

A.The PV is provisioned immediately on the node specified in the StorageClass's allowedTopologies.
B.The node where the Pod is scheduled.
C.Any node in the cluster that has sufficient resources for the PV.
D.The control plane node.
AnswerB

This option is correct. When a StorageClass uses the WaitForFirstConsumer volume binding mode, the Kubernetes scheduler plays a crucial role. It first finds a suitable node for the Pod, considering all its requirements, including the PVC. Once the Pod is scheduled to a specific node, the PersistentVolume is then dynamically provisioned on that very node, ensuring optimal data locality and performance for the Pod.

Why this answer

When a StorageClass uses volumeBindingMode: WaitForFirstConsumer, the PersistentVolume (PV) is not provisioned until a Pod that uses the PersistentVolumeClaim (PVC) is scheduled. The PV is then provisioned on the exact node where the Pod is scheduled, ensuring that the volume is created in the same zone or topology as the Pod. This avoids unnecessary cross-zone data transfer and ensures the PV is available locally to the Pod's node.

Exam trap

The trap here is that candidates assume PV provisioning happens immediately when the PVC is created, or that it is tied to a specific node defined in the StorageClass, rather than understanding that WaitForFirstConsumer delays provisioning until Pod scheduling and ties it to the Pod's node.

How to eliminate wrong answers

Option A is wrong because allowedTopologies in a StorageClass is used with Immediate binding mode to restrict provisioning to specific zones, but with WaitForFirstConsumer, the PV is provisioned on the node where the Pod is scheduled, not necessarily on a node matching allowedTopologies unless the scheduler enforces it. Option C is wrong because the PV is not provisioned on 'any node with sufficient resources'; it is specifically provisioned on the node where the Pod is scheduled, and the scheduler considers topology constraints from the PVC and StorageClass. Option D is wrong because the control plane node is not involved in PV provisioning for WaitForFirstConsumer; the PV is provisioned on the worker node where the Pod runs, not on the control plane.

543
MCQmedium

You run 'kubectl get pods' and see that a pod is in 'CrashLoopBackOff'. You want to examine the container's previous exit code. Which command provides this information?

A.kubectl get events
B.kubectl describe pod pod-name
C.kubectl logs pod-name --previous
D.kubectl logs pod-name
AnswerB

kubectl describe pod pod-name aggregates the pod's current and recent states under the Status section, including the 'Last State' fields where the container's terminated reason and exit code are explicitly shown. This is the canonical way to inspect why a container crashed, because it presents the last container's exit code (e.g., 137 for SIGKILL or 1 for a general error) along with the reason, message, and timestamps. It also includes recent event history, making it the most direct command to answer the question.

Why this answer

The correct option is B, `kubectl describe pod pod-name`, because the pod's status section in the describe output includes the container's `Last State` with the previous termination reason and exit code, which is exactly what is needed to examine why the container exited. `kubectl get events` (A) only shows cluster event messages and does not report the container's exit code. `kubectl logs pod-name --previous` (C) retrieves the previous container's log output, not its exit code, and `kubectl logs pod-name` (D) shows the current container's logs, which may be empty or unavailable in a CrashLoopBackOff state.

544
MCQhard

A cluster administrator manages a PersistentVolume with reclaim policy Retain that was bound to a PersistentVolumeClaim. The application team deletes the PVC, but the administrator later needs to reuse the same underlying storage for a new PVC in the same namespace. After the PVC deletion, the PV shows status Released. Which sequence of actions must the administrator perform to make the PV bindable again?

A.Create a new PVC with the same name as the deleted PVC and the same capacity; Kubernetes will automatically rebind the Released PV.
B.Edit the PV to remove the claimRef field (or set it to null), then create a new PVC that matches the PV's capacity and access modes.
C.Change the PV's reclaim policy to Delete, then delete and recreate the PVC.
D.Delete the PV and recreate it with the same storage backend configuration, then create the new PVC.
AnswerB

A Released PV retains a claimRef pointing to the deleted PVC, which prevents binding to a new claim. Removing the claimRef field makes the PV Available again, allowing a new PVC with matching capacity and access modes to bind. This is the documented reclaim procedure for Retain policy volumes.

Why this answer

Under the Retain policy, deleting a PVC leaves the PV in Released state with a claimRef to the deleted claim. To reuse the storage, the administrator must remove the claimRef so the PV becomes Available, then create a new PVC whose capacity and access modes match. Deleting the PV or changing the reclaim policy risks data loss and does not restore bindability.

Exam trap

The trap here is believing that a Released PV will automatically rebind to a new PVC with the same name, when the stale claimRef must be manually cleared first.

545
MCQmedium

A developer needs to create a Role that allows listing pods in the 'dev' namespace. Which YAML snippet correctly defines this Role?

A.apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: pod-lister rules: - apiGroups: [""] resources: ["pods"] verbs: ["list"]
B.apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: pod-lister-binding namespace: dev subjects: - kind: User name: dev-user roleRef: kind: Role name: pod-lister apiGroup: rbac.authorization.k8s.io
C.apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: pod-lister namespace: dev rules: - apiGroups: [""] resources: ["pods"] verbs: ["list"]
D.apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: pod-lister rules: - apiGroups: [""] resources: ["pods"] verbs: ["get"]
AnswerC

The Role is namespaced, so scoping it to `dev` via `metadata.namespace` confines the grant to that namespace alone. `apiGroups: [""]` correctly targets the core API group, where pods reside, and `verbs: ["list"]` matches the required action. ClusterRole would be needed only for cluster-wide access.

Why this answer

It defines a Role (not ClusterRole) scoped to the 'dev' namespace with the 'list' verb on 'pods', which matches the requirement exactly. In Kubernetes RBAC, a Role grants permissions within a specific namespace, and the empty apiGroups string [""] refers to the core API group where pods reside.

Exam trap

The trap here is that candidates often confuse 'get' with 'list' or choose a ClusterRole thinking it can be used for namespace-scoped access, but the CKA exam tests precise understanding that a Role must be namespace-scoped and use the correct verb for the intended operation.

How to eliminate wrong answers

Option A is wrong because it defines a ClusterRole, which is cluster-scoped and not namespace-scoped; while a ClusterRole can be used to grant permissions across namespaces, the requirement specifically asks for a Role in the 'dev' namespace. Option B is wrong because it defines a RoleBinding, which binds a Role to a user but does not define the Role itself; the question asks for the Role definition, not the binding. Option D is wrong because it defines a Role with the verb 'get' instead of 'list'; 'get' allows retrieving a specific pod by name, but the requirement is to list pods, which requires the 'list' verb.

546
Multi-Selectmedium

Which TWO of the following are valid steps to troubleshoot a pod that is in 'CrashLoopBackOff'?

Select 2 answers
A.Run 'kubectl exec -it pod-name -- /bin/bash' to inspect the container
B.Run 'kubectl logs pod-name --previous' to view logs from the previous crash
C.Run 'kubectl describe pod pod-name' to see events and state
D.Run 'kubectl rollout restart deployment/pod-name'
E.Run 'kubectl delete pod pod-name' to force restart
AnswersB, C

Logs are the first place to look for process exit reasons. `kubectl logs pod-name --previous` retrieves the captured stdout/stderr from the last crashed container instance, whereas the default `kubectl logs` shows the current (possibly non-existent) container. This lets you see the application's actual error, panic, or stack trace that occurred before the crash, even if the current container is in a CrashLoopBackOff state. This makes it a valid and often essential troubleshooting step.

Why this answer

Option B is correct because when a pod is in CrashLoopBackOff the current container is usually not running, so 'kubectl logs pod-name --previous' retrieves the logs from the last terminated container instance, which is essential for diagnosing why it crashed. Option C is correct because 'kubectl describe pod pod-name' shows the pod's status, container states, restart counts, and the event stream (e.g., Back-off restarting failed container, image pull errors, OOMKilled), giving the key context for the crash loop. Option A is not a valid troubleshooting step here because 'kubectl exec' requires a running container, and a pod in CrashLoopBackOff has no live container to attach to.

Option D is not a diagnostic step; 'kubectl rollout restart' merely triggers a new rollout and does not reveal the cause of the crash. Option E is also not troubleshooting; deleting the pod just causes the controller to recreate it, and the new pod will likely crash again for the same underlying reason.

Exam trap

CKA often tests the misconception that 'kubectl exec' can be used on a crashed container, but in CrashLoopBackOff the container is not running, so exec fails, while 'kubectl logs --previous' is the correct way to retrieve crash logs.

547
MCQhard

An administrator needs to configure dynamic provisioning for persistent volumes using an external CSI driver. Which of the following is the correct approach?

A.Set the 'volumeBindingMode' to 'Immediate' in the PVC.
B.Install the CSI driver and then all PVCs will automatically be provisioned.
C.Create a StorageClass with 'provisioner' set to the CSI driver name.
D.Create a PersistentVolume with the CSI driver name in the 'csi' section.
AnswerC

To enable dynamic provisioning, you must define a 'StorageClass' object where the 'provisioner' field matches the registered name of your CSI driver. When a user submits a 'PersistentVolumeClaim' referencing this 'StorageClass', the Kubernetes volume controller automatically invokes the specified CSI driver to provision the underlying storage asset and create the corresponding 'PersistentVolume' on demand.

Why this answer

Dynamic provisioning in Kubernetes requires a StorageClass object that references the CSI driver as its provisioner. When a PVC requests a StorageClass with a CSI provisioner, the CSI external-provisioner sidecar automatically creates a PersistentVolume and binds it to the PVC. Without the StorageClass, Kubernetes has no way to know which CSI driver should handle the provisioning request.

Exam trap

The trap here is that candidates often think installing the CSI driver alone is sufficient for dynamic provisioning (Option B), but they miss the critical requirement of creating a StorageClass that explicitly links the PVC request to the CSI driver's provisioner name.

How to eliminate wrong answers

Option A is wrong because 'volumeBindingMode' is a field on the StorageClass, not the PVC, and setting it to 'Immediate' controls when binding and dynamic provisioning occur (immediately vs. delayed until pod scheduling), not how the CSI driver is configured. Option B is wrong because simply installing the CSI driver does not enable automatic provisioning; a StorageClass must be created that references the CSI driver's provisioner name, and PVCs must request that StorageClass. Option D is wrong because a PersistentVolume is a static resource that must be manually created or dynamically provisioned; specifying the CSI driver in a PV's 'csi' section is used for static provisioning, not for dynamic provisioning.

548
Multi-Selecthard

Which THREE components must be present in a high-availability control plane setup?

Select 3 answers
A.kubelet
B.kube-proxy
C.kube-controller-manager
D.etcd
E.kube-apiserver
AnswersC, D, E

The kube-controller-manager bundles the core control loops that reconcile the cluster's actual state toward the desired state, such as node lifecycle, replication, and endpoint management. It is essential for a HA control plane because in that setup you run multiple replicas with leader election, so only one instance actively runs controllers while the others stand by, but at least one must be reachable via the API server. Without it, no automated corrections would be made to workloads, making it an indispensable control-plane component.

Why this answer

In a highly available Kubernetes control plane, the three essential components are the kube-controller-manager (C), etcd (D), and kube-apiserver (E). The kube-apiserver (E) is the central management endpoint that all clients and internal components communicate with, and it must be replicated behind a load balancer for HA. etcd (D) is the distributed key-value store that holds all cluster state; running it as an odd-numbered quorum across multiple nodes provides fault tolerance. The kube-controller-manager (C) runs the control loops that reconcile cluster state, and in HA it is typically deployed on multiple control-plane nodes with leader election so one active instance drives reconciliation. kubelet (A) and kube-proxy (B) are node-level components that run on every worker node, not control-plane HA components, so they are not required for a high-availability control plane setup.

Exam trap

CNCF often tests the distinction between control plane components and node-level agents, so candidates mistakenly include kubelet or kube-proxy as part of the control plane because they are essential to cluster operation, but they are not part of the control plane's high-availability architecture.

549
Multi-Selectmedium

Which TWO of the following are valid methods to configure kubectl to use a specific context?

Select 2 answers
A.kubectl config set-context my-context
B.kubectl config current-context
C.kubectl config use-context my-context
D.export KUBECONFIG=/path/to/config
E.kubectl --config /path/to/config get pods
AnswersC, D

This explicitly sets the current-context field to my-context in the kubeconfig file, making kubectl use that context for subsequent commands. It performs the validation-free update needed to switch a running session from one context to another, and is the standard command for changing the active context. This makes it a valid configuration method.

Why this answer

Option C, `kubectl config use-context my-context`, is correct because it directly switches the current context in the kubeconfig file, making all subsequent kubectl commands target that context's cluster, user, and namespace. Option D, `export KUBECONFIG=/path/to/config`, is correct because setting the KUBECONFIG environment variable tells kubectl which kubeconfig file(s) to load, thereby selecting the context defined in that file (or the file's current-context). Option A is not a valid way to select a context because `kubectl config set-context my-context` creates or modifies a context entry but does not activate it.

Option B, `kubectl config current-context`, only displays the currently active context and does not configure or change it. Option E, `kubectl --config /path/to/config get pods`, is invalid because kubectl has no `--config` flag; the correct flag is `--kubeconfig`.

Exam trap

The trap here is that candidates confuse `set-context` (which only defines or updates a context) with `use-context` (which activates it), and also mistakenly think `--config` is a valid kubectl flag when the correct flag is `--kubeconfig`.

550
Multi-Selectmedium

Which TWO of the following are valid reclaim policies for PersistentVolumes?

Select 2 answers
A.Retain
B.Delete
C.Recycle
D.Archive
E.Reuse
AnswersA, B

Retain is a valid reclaim policy because when a PersistentVolume is released from a PersistentVolumeClaim, the underlying storage resource is kept intact. The volume is not automatically removed or scrubbed; instead, it remains in a Released state until a cluster administrator manually intervenes to recover or reuse it. This policy is essential for protecting critical data from accidental deletion.

Why this answer

Option A, Retain, is correct because it is one of the two officially supported PersistentVolume reclaim policies in Kubernetes: when a bound PVC is deleted, the PV is left intact and its data is preserved, requiring manual reclamation. Option B, Delete, is also correct because it is the other supported reclaim policy: it instructs Kubernetes to delete the PV object and, for dynamic provisioners, the underlying storage asset (e.g., an AWS EBS volume or GCE PD) when the PVC is released. Option C, Recycle, is not correct because although it existed as a legacy policy performing a basic scrub (rm -rf /thevolume/*) and making the volume available again, it was deprecated and removed in Kubernetes 1.14.

Option D, Archive, is not a valid reclaim policy at all, and Option E, Reuse, is likewise not a recognized reclaim policy value in the PersistentVolume spec's persistentVolumeReclaimPolicy field, which accepts only Retain, Delete, and formerly Recycle.

Exam trap

The trap here is that candidates may confuse deprecated or non-existent policies (like Recycle or Archive) with valid ones, or assume that Recycle is still supported, when in fact only Retain and Delete are currently valid for the CKA exam.

551
MCQmedium

A pod cannot resolve a Service name 'my-svc' in the same namespace. The DNS pod is running. What is a likely cause?

A.The kube-proxy is not running
B.The Service type is ExternalName
C.The Service 'my-svc' does not exist
D.The pod is in a different namespace
AnswerC

CoreDNS generates DNS records only for Service objects that actually exist. If no Service named my-svc exists in the pod's namespace, the query for my-svc.<namespace>.svc.cluster.local returns NXDOMAIN, which is exactly the failure described. Because the short name my-svc is expanded using the pod's search domains to include the namespace, a missing Service object means no A record can be synthesized. Running kubectl get svc -n <namespace> to confirm that the Service is present is the correct first troubleshooting step.

Why this answer

If the Service 'my-svc' does not exist, the CoreDNS pod will not have an A/AAAA record for it, and DNS resolution will fail with NXDOMAIN. The pod's DNS resolver queries the cluster's DNS service (typically CoreDNS) for the Service name; if no matching Service object is defined, no DNS record is created, and the name cannot be resolved regardless of other components being healthy.

Exam trap

The trap here is that candidates often confuse DNS resolution issues with network connectivity issues, incorrectly attributing the failure to kube-proxy or Service type, when the root cause is simply that the Service object does not exist and thus has no DNS record.

How to eliminate wrong answers

Option A is wrong because kube-proxy handles traffic forwarding to Service endpoints, not DNS resolution; a missing or misconfigured kube-proxy would cause connectivity failures (e.g., connection refused or timeout) but would not prevent DNS name resolution itself. Option B is wrong because an ExternalName Service type returns a CNAME record pointing to an external DNS name, which would still resolve successfully (to the external name) and not cause a failure to resolve 'my-svc' in the same namespace. Option D is wrong because the question explicitly states the pod and Service are in the same namespace; even if they were in different namespaces, DNS resolution would still work by using the fully qualified domain name (e.g., 'my-svc.<namespace>.svc.cluster.local'), so being in a different namespace would not prevent resolution of a Service that exists.

552
MCQmedium

An administrator runs 'kubectl run test-pod --image=nginx' and the pod is created but stays in 'Pending' state. Which command would BEST help diagnose why the pod is not running?

A.kubectl logs test-pod
B.kubectl describe pod test-pod
C.kubectl exec -it test-pod -- /bin/bash
D.kubectl get events
AnswerB

The `kubectl describe pod` command provides a comprehensive, human-readable summary of a specific pod's current state, including its status, conditions, and a chronological list of *events* directly associated with it. For a pending pod, this command is invaluable as it surfaces critical information such as scheduler decisions, volume attachment issues, image pull failures, or resource constraints directly within the 'Events' section, clearly indicating the root cause of the pending state.

Why this answer

`kubectl describe pod test-pod` provides a detailed summary of the pod's current state, including events, conditions, and status messages that reveal why the pod is stuck in 'Pending'. The 'Pending' state typically indicates that the pod has not been scheduled to a node, often due to resource constraints (CPU/memory), persistent volume claims not being bound, or node selector mismatches. The 'Conditions' and 'Events' sections in the output directly expose these issues, making it the most effective diagnostic command.

Exam trap

The trap here is that candidates often assume `kubectl logs` or `kubectl exec` can diagnose startup issues, but these commands only work on running containers, so they fail silently or with errors when the pod is still pending, wasting time and misdirecting troubleshooting.

How to eliminate wrong answers

Option A is wrong because `kubectl logs test-pod` retrieves container logs, but the pod is in 'Pending' state and has not started any containers, so there are no logs to fetch; this command would fail with an error like 'container is waiting to start'. Option C is wrong because `kubectl exec -it test-pod -- /bin/bash` attempts to execute a command inside a running container, but since the pod is not running (Pending), there is no container to attach to, and the command will fail. Option D is wrong because `kubectl get events` shows cluster-wide events, which may include relevant information but is less targeted than `kubectl describe pod`; it requires filtering through many events and may not show pod-specific details like scheduler failure reasons or volume binding errors as clearly.

553
MCQmedium

The controller-manager logs show repeated errors: 'Failed to list *v1.Pod: connection refused'. What is the most likely cause?

A.The API server is down or not reachable
B.The kube-controller-manager is not running
C.The kubelet on the controller node is down
D.The scheduler is overloading the API server
AnswerA

The kube-controller-manager is a client of the Kubernetes API server; every control loop (deployment, replicaset, namespace, service account) lists objects through the API. A repeated 'failed to list' or connection-refused error means the API server is either down, unresponsive, or unreachable from the controller node. This is the only condition that explains the manager's own client logs while the manager process itself remains running.

Why this answer

The controller-manager communicates with the API server. 'connection refused' indicates the API server is not reachable or not running.

554
MCQeasy

You run 'kubectl get events --sort-by='.lastTimestamp'' and see repeated events: 'Failed to pull image "myimage:v2": rpc error: code = Unknown desc = Error response from daemon: manifest for myimage:v2 not found'. What is the issue?

A.The pod has insufficient privileges to pull the image.
B.The image registry is down.
C.The container runtime is not running.
D.The image tag 'myimage:v2' does not exist in the registry.
AnswerD

The error message for a missing tag in a registry is typically 'manifest unknown' or 'not found' (HTTP 404). The question states that the error clearly indicates the manifest is not found for the tag 'myimage:v2', which means that specific tag does not exist in the registry. This is a definitive registry-side response: the registry is reachable, the repository may exist, but the requested tag has no associated manifest.

Why this answer

The error 'manifest not found' means the image tag does not exist in the registry. The pod is in ImagePullBackOff because the image is missing.

555
MCQeasy

Which command shows resource usage for pods and nodes in the cluster?

A.kubectl top pods and kubectl top nodes
B.kubectl cluster-info
C.kubectl get --sort-by=.status.capacity
D.kubectl describe pods and kubectl describe nodes
AnswerA

kubectl top pods and kubectl top nodes are the correct commands because they query the Metrics API (backed by metrics-server) and display real-time CPU and memory utilization for pods and nodes. kubectl top provides immediate, current usage values, which is exactly what 'resource usage' means in a Kubernetes context.

Why this answer

The metrics server must be installed. 'kubectl top pods' shows pod CPU/memory usage, and 'kubectl top nodes' shows node usage.

556
Drag & Dropmedium

Drag and drop the steps to back up and restore etcd data for a Kubernetes cluster into the correct order.

Drag or tap steps into the slots.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4

Why this order

The correct order ensures that you capture a consistent snapshot, verify its integrity, stop etcd to avoid conflicts, restore the data, start etcd, and then confirm the cluster is healthy. Skipping steps or doing them out of order can lead to data loss or cluster instability.

557
MCQeasy

Which kubectl command is used to mark a node as unschedulable so that no new pods are scheduled onto it?

A.kubectl taint <node>
B.kubectl uncordon <node>
C.kubectl drain <node>
D.kubectl cordon <node>
AnswerD

The kubectl cordon command is the precise administrative tool used to toggle a node's status to unschedulable by updating its spec.unschedulable field to true. This action prevents the scheduler from assigning any new pods to the node while safely leaving existing, currently running workloads completely unaffected.

Why this answer

The `kubectl cordon <node>` command marks a node as unschedulable by setting the `node.Spec.Unschedulable` field to `true`. This prevents the Kubernetes scheduler from placing any new pods onto that node, while existing pods continue to run unaffected. This is the correct command for the described task.

Exam trap

The trap here is confusing `cordon` with `drain`—candidates often pick `drain` because they think it makes the node unschedulable, but `drain` additionally evicts all pods, which is not what the question asks for.

How to eliminate wrong answers

Option A is wrong because `kubectl taint <node>` adds a taint to a node, which repels pods that do not have a matching toleration, but it does not directly make the node unschedulable for all new pods—pods with appropriate tolerations can still be scheduled. Option B is wrong because `kubectl uncordon <node>` does the opposite: it marks a node as schedulable by setting `node.Spec.Unschedulable` to `false`, allowing new pods to be scheduled. Option C is wrong because `kubectl drain <node>` evicts all pods from the node and then cordons it, but the primary action is pod eviction, not merely marking the node unschedulable; it is a more destructive operation that also terminates running workloads.

558
MCQmedium

A cluster was installed using kubeadm. You need to upgrade the cluster from v1.28 to v1.29. Which of the following is the correct order of operations?

A.Drain each node, upgrade control plane, then upgrade worker nodes
B.Drain control plane node, upgrade kubeadm and kubelet on control plane, uncordon, then repeat for worker nodes
C.Upgrade worker nodes first, then control plane nodes
D.Upgrade all nodes simultaneously
AnswerB

This is the exact procedure recommended by the official kubeadm upgrade documentation: for the control plane node, run `kubectl drain` (with `--ignore-daemonsets`), upgrade the `kubeadm` binary, run `kubeadm upgrade apply`, upgrade `kubelet`, restart it, then `uncordon` the node. Repeating the same drain-upgrade-uncordon cycle for worker nodes ensures they remain within the supported version skew and maintains cluster availability throughout the rolling upgrade.

Why this answer

The kubeadm upgrade process requires the control plane node to be upgraded first, as it hosts the core cluster components (API server, scheduler, controller-manager). Draining the node ensures workloads are evicted, then kubeadm and kubelet are upgraded on the control plane, followed by uncordoning. Worker nodes are upgraded afterward to maintain cluster stability and compatibility.

Exam trap

The trap here is that candidates often assume all nodes can be upgraded in any order or simultaneously, but the CKA requires strict sequential upgrade of control plane first, then workers, with drain/uncordon steps.

How to eliminate wrong answers

Option A is wrong because it suggests draining all nodes before upgrading, but the control plane must be upgraded first, not simultaneously with workers. Option C is wrong because upgrading worker nodes before the control plane would break cluster coordination, as the API server version must be higher or equal to kubelet versions. Option D is wrong because upgrading all nodes simultaneously is not supported with kubeadm; it would cause version mismatches and potential cluster downtime.

559
MCQmedium

You have a Deployment with 3 replicas. After updating the container image, the new pods are in 'ImagePullBackOff' state. You run 'kubectl describe pod <pod-name>' and see the event: 'Failed to pull image "myregistry/myapp:latest": rpc error: code = Unknown desc = Error response from daemon: manifest for myregistry/myapp:latest not found: manifest unknown: manifest unknown'. What is the MOST likely cause?

A.The registry is unreachable from the nodes
B.The image tag 'latest' does not exist in the registry
C.The registry requires authentication and the pod does not have an imagePullSecret
D.The container runtime is out of disk space
AnswerB

The error "manifest not found" specifically indicates that the container registry was successfully contacted, but it does not contain a schema or manifest matching the requested repository and tag combination. This occurs when the deployment specifies an image tag, such as "latest", that was never pushed to the registry or has been deleted.

Why this answer

The error message 'manifest unknown' indicates that the registry successfully reached but the specific image tag 'latest' does not exist in the repository. This is a registry-side error, not a network or authentication issue. The container runtime can communicate with the registry but cannot find the manifest for the requested tag.

Exam trap

Kubernetes often tests the distinction between registry reachability errors and image existence errors, where candidates mistakenly assume network or authentication issues when the actual problem is a missing tag in the registry.

How to eliminate wrong answers

Option A is wrong because the error 'manifest unknown' confirms the registry was reachable; an unreachable registry would produce a different error like 'connection refused' or 'timeout'. Option C is wrong because authentication failures produce errors like 'unauthorized: authentication required' or 'denied: requested access to the resource is denied', not 'manifest unknown'. Option D is wrong because disk space issues produce errors like 'no space left on device' or 'failed to create shim task', not manifest lookup failures.

560
MCQeasy

Which command can be used to view resource usage of nodes in a cluster?

A.kubectl describe nodes
B.kubectl top pods
C.kubectl get pods --show-resources
D.kubectl top nodes
AnswerD

kubectl top nodes queries the Metrics API, which is backed by metrics-server, to report each node's current CPU and memory usage as a percentage of allocatable capacity. This is the standard command for quickly assessing real-time node utilization in a cluster. It requires the metrics-server (or a compatible metrics API) to be installed and producing node metrics.

Why this answer

The 'kubectl top nodes' command displays resource usage (CPU and memory) for nodes in the cluster. It requires the Metrics Server to be installed and running. This command provides a quick view of node utilization.

Exam trap

CKA often tests the difference between 'kubectl top' and 'kubectl describe' for resource usage, and candidates may incorrectly choose 'describe nodes' thinking it shows live usage.

How to eliminate wrong answers

Option A is wrong because 'kubectl describe nodes' shows detailed node information including capacity, allocatable resources, and conditions, but not real-time resource usage. Option B is wrong because 'kubectl top pods' shows resource usage for pods, not nodes. Option C is wrong because 'kubectl get pods --show-resources' is not a valid command; there is no such flag.

561
MCQmedium

You run 'kubectl get pods -n default' and see a pod named 'backend' in ImagePullBackOff state. What is the most likely cause?

A.The image name or tag is incorrect
B.The node is out of disk space
C.The container's memory limit is too low
D.The pod's service account lacks permissions
AnswerA

ImagePullBackOff is the kubelet's status when it fails to fetch a container image, and the most frequent cause is a typo in the image name or an invalid/unavailable tag (for example, `nginx:lateest` or `myapp:v2` that does not exist in the registry). The kubelet retries the pull with an exponential backoff, and the underlying error — such as `manifest unknown` or `not found` — is visible in the pod's Events via `kubectl describe pod`. Because the image reference itself is unresolvable, the container never starts and the pod remains in this state until the image reference is corrected.

Why this answer

ImagePullBackOff indicates Kubernetes cannot pull the container image, often due to a tag typo or non-existent image.

562
MCQeasy

An administrator creates a NetworkPolicy in namespace 'app' with the following YAML. Which statement is true about the policy? apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: deny-all spec: podSelector: {} policyTypes: - Ingress

A.The policy denies all ingress traffic to no pods because no podSelector is specified.
B.The policy denies all egress traffic from all pods in the 'app' namespace.
C.The policy denies all ingress traffic to all pods in the 'app' namespace.
D.The policy allows all ingress traffic to all pods in the 'app' namespace.
AnswerC

An empty `podSelector` targets all pods in the 'app' namespace, and because the policy defines `Ingress` in its `policyTypes` but contains no allowed ingress rules, it acts as a default-deny policy. This effectively blocks all incoming traffic to every pod in that namespace.

Why this answer

The NetworkPolicy uses an empty `podSelector: {}`, which selects all pods in the namespace, and specifies `policyTypes: [Ingress]` with no ingress rules. By default, Kubernetes NetworkPolicy denies all ingress traffic that is not explicitly allowed, so this policy effectively blocks all incoming traffic to every pod in the 'app' namespace.

Exam trap

The trap here is that candidates often misinterpret an empty `podSelector: {}` as selecting no pods, when in fact it selects all pods in the namespace, leading them to incorrectly choose option A.

How to eliminate wrong answers

Option A is wrong because an empty `podSelector: {}` selects all pods, not no pods; it is a common misconception that an empty selector matches nothing, but in Kubernetes it matches everything. Option B is wrong because the policy only specifies `policyTypes: [Ingress]`, so it has no effect on egress traffic; egress traffic remains unrestricted unless an egress rule is defined. Option D is wrong because the policy has no ingress rules, and the default behavior of a NetworkPolicy with `policyTypes: [Ingress]` is to deny all ingress traffic, not allow it.

563
MCQeasy

A developer wants to deploy a pod that will run only once to initialize a database schema. Which Kubernetes resource should they use?

A.DaemonSet
B.Job
C.Deployment
D.CronJob
AnswerB

A Job controller creates one or more pods and tracks them until a specified number successfully terminate. For a one-time task, a simple Job with default completions=1 runs once to completion, and the workload is not recreated if it exits with code 0. It is the native Kubernetes API for exactly-once batch processing.

Why this answer

A Job is the correct Kubernetes resource for a one-time task that runs to completion, such as initializing a database schema. Unlike controllers that maintain a desired number of replicas, a Job creates one or more Pods and ensures they successfully terminate, making it ideal for batch or initialization workloads.

Exam trap

The trap here is that candidates often confuse a Job with a CronJob, thinking they need scheduling, or with a Deployment, assuming all workloads must be continuously running, when the key differentiator is the 'run to completion' lifecycle.

How to eliminate wrong answers

Option A is wrong because a DaemonSet ensures that a copy of a Pod runs on every node (or a subset of nodes) in the cluster, which is designed for continuous daemon processes like logging or monitoring, not a one-time initialization task. Option C is wrong because a Deployment manages a set of Pods to maintain a desired state with rolling updates and self-healing, intended for long-running stateless applications, not a single run-to-completion job. Option D is wrong because a CronJob is used for scheduling Jobs to run at specific times or intervals, which is overkill and incorrect for a task that should run only once immediately.

564
MCQmedium

A Pod in a Deployment is CrashLoopBackOff. 'kubectl logs' shows the application exits with code 1 after printing one line. The Pod has a liveness probe that checks an HTTP endpoint. What should be checked first?

A.Check the application logs and configuration that causes the exit code 1.
B.Check if the liveness probe's initialDelaySeconds is too short.
C.Check if the liveness probe endpoint is correctly configured.
D.Check if the container has insufficient memory limits.
AnswerA

When a container terminates with exit code 1, it indicates an application-level failure or configuration error rather than an external infrastructure issue. Inspecting the container logs using `kubectl logs` is the primary troubleshooting step to identify runtime exceptions, missing environment variables, or syntax errors causing the process to crash immediately upon startup.

Why this answer

The application exits with code 1 after printing one line, which indicates a runtime error in the application itself. The liveness probe only restarts the container after the application has already failed; it does not prevent the initial crash. Therefore, the first step is to examine the application logs and configuration to understand why the process exits with code 1, as this is the root cause of the CrashLoopBackOff.

Exam trap

The trap here is that candidates often focus on the liveness probe configuration (options B and C) because the question mentions it, but the immediate cause is the application crash itself, which must be diagnosed first via logs.

How to eliminate wrong answers

Option B is wrong because adjusting initialDelaySeconds would only delay the start of liveness checks; it does not address the application exiting with code 1. Option C is wrong because the liveness probe endpoint configuration is irrelevant when the application crashes before the probe can even be evaluated. Option D is wrong because insufficient memory limits typically cause OOMKilled (exit code 137) or resource pressure, not a clean exit code 1 after printing one line.

565
MCQeasy

Which command is used to take a snapshot of etcd data for backup?

A.etcdctl export
B.etcdctl backup
C.etcdctl dump
D.etcdctl snapshot save
AnswerD

This is the official and recommended command under the etcd v3 API to create a point-in-time, consistent backup of the keyspace. It securely writes the active database state to a specified file path on the local disk. For a successful execution in a secure Kubernetes cluster, this command must be accompanied by the appropriate CA certificate, client certificate, and private key flags.

Why this answer

The correct command to take a snapshot of etcd data for backup is `etcdctl snapshot save`. This command creates a point-in-time snapshot of the etcd key-value store, which can be used to restore the cluster state. The `snapshot save` subcommand is the official method for backing up etcd data in Kubernetes environments.

Exam trap

The trap here is that candidates may confuse `etcdctl backup` (a legacy v2 command) or `etcdctl dump` (a non-existent command) with the correct `etcdctl snapshot save`, especially since the word 'backup' is intuitive but not the actual command in etcd v3.

How to eliminate wrong answers

Option A is wrong because `etcdctl export` is not a valid subcommand; the correct subcommand for exporting data is `etcdctl get` with a prefix, but that does not create a consistent snapshot. Option B is wrong because `etcdctl backup` is not a valid subcommand; the legacy `etcdctl backup` was used in older etcd v2 but is deprecated and not available in etcd v3, which is the standard for Kubernetes. Option C is wrong because `etcdctl dump` is not a valid subcommand; there is no `dump` command in etcdctl, and it likely confuses with database dump tools.

566
MCQeasy

Which component is responsible for maintaining network rules on worker nodes?

A.kube-proxy
B.kube-scheduler
C.kubelet
D.kube-controller-manager
AnswerA

kube-proxy is the component that directly maintains network rules on each node. It watches the Kubernetes API for Service and EndpointSlice objects, then programs iptables rules (or IPVS entries) to translate a Service's ClusterIP to the IP addresses of its backing Pods. This provides load-balanced, virtual-IP connectivity to Pods without a traditional proxy process in the data path.

Why this answer

kube-proxy is the component responsible for maintaining network rules on worker nodes. It watches the Kubernetes API server for changes to Services and EndpointSlices, then updates iptables, IPVS, or userspace rules on the node to route traffic to the correct Pods. This ensures that network traffic directed at a Service's ClusterIP or NodePort is properly forwarded to the backend Pods.

Exam trap

The trap here is that candidates often confuse kubelet with kube-proxy because both run on worker nodes, but kubelet manages containers while kube-proxy manages network rules.

How to eliminate wrong answers

Option B (kube-scheduler) is wrong because it is responsible for assigning Pods to nodes based on resource availability and scheduling policies, not for maintaining network rules. Option C (kubelet) is wrong because it is the primary node agent that manages Pod lifecycle, container health, and mounts volumes, but it does not handle network rule enforcement. Option D (kube-controller-manager) is wrong because it runs controller processes such as the Node Controller, Replication Controller, and Endpoint Controller, but it does not implement per-node network rules.

567
MCQmedium

You run 'kubectl top nodes' and get an error: 'error: metrics not available yet'. What is the most likely cause?

A.The nodes do not have enough resources to run the metrics collection
B.You do not have permission to view node metrics
C.The kubelet is not running on the nodes
D.The metrics-server is not installed or not running
AnswerD

kubectl top nodes relies on the metrics-server to collect resource usage from each kubelet and expose them through the metrics.k8s.io API. If metrics-server is not installed, the API endpoint returns 404 or no data, and kubectl top prints an error such as "error: metrics not available yet". If metrics-server is installed but not running (CrashLoopBackOff, pending), the same failure occurs because the API aggregator has no healthy backing service. Therefore, verifying the metrics-server deployment and its API service is the first step.

Why this answer

The metrics server is not deployed or not ready; kubectl top requires the metrics server to collect resource usage data.

568
MCQmedium

A Pod is stuck in CrashLoopBackOff. You run `kubectl logs <pod-name>` but see no output. What is the most likely cause?

A.The pod has no container defined.
B.The container crashes before writing to stdout/stderr.
C.The kubelet is not forwarding logs.
D.The pod is in a different namespace.
AnswerB

When a container enters CrashLoopBackOff, the kubelet has successfully started the process and the runtime is restarting it because of a non-zero exit. If the application dies immediately—for example, due to a missing executable, an invalid ENTRYPOINT, a panic before logging setup, or an exec format error—there is no stdout/stderr capture for kubectl logs to return. The restart count increments and the container's state becomes Waiting with reason CrashLoopBackOff, but the logs remain empty.

Why this answer

When a container crashes before it can write any output to stdout or stderr, `kubectl logs` returns no output because there is no log data to retrieve. This is a common symptom of a container that fails during initialization or immediately upon entry point execution, before any logging occurs.

Exam trap

The trap here is that candidates may assume empty logs indicate a logging infrastructure issue (like kubelet failure) rather than recognizing that the container simply never produced any output before crashing.

Why the other options are wrong

A

A pod must have at least one container; if not, it wouldn't be scheduled.

C

The kubelet forwards logs from the container runtime; if logs exist, they should appear.

D

kubectl logs defaults to the default namespace; if the pod is in another namespace, you'd get an error, not empty output.

569
MCQeasy

You need to check the logs of a kubelet on a node. Which command should you run on the node?

A.journalctl -u docker
B.dmesg
C.tail -f /var/log/apache2/access.log
D.journalctl -u kubelet
AnswerD

`journalctl -u kubelet` is the correct approach because kubelet is registered as a systemd service under the unit name `kubelet.service` on essentially all managed Kubernetes distributions. This command displays all journal entries associated with that unit, preserving timestamps, priorities, and source metadata. It is the standard first step for diagnosing kubelet failures, and can be combined with flags like `-f`, `-n 100`, or `--since` for targeted live troubleshooting.

Why this answer

The kubelet is a systemd-managed service on most Kubernetes nodes (installed as kubelet.service), so its logs are captured by the systemd journal. Running `journalctl -u kubelet` queries the journal for entries tagged with the kubelet unit, showing startup messages, pod sync errors, certificate issues, and container runtime interactions. This is the canonical way to inspect kubelet behavior on a node for CKA troubleshooting tasks.

Exam trap

CKA often tests whether candidates know that kubelet is a systemd unit and its logs live in the journal, not in a flat file like /var/log/kubelet.log or in the container runtime's logs.

How to eliminate wrong answers

Option A is wrong because `journalctl -u docker` queries the Docker daemon's unit, not the kubelet — Docker is the container runtime, and its logs are unrelated to kubelet control-plane operations (and modern clusters often use containerd instead). Option B is wrong because `dmesg` reads the kernel ring buffer, which shows hardware, driver, and low-level kernel messages — not kubelet service output. Option C is wrong because `/var/log/apache2/access.log` is an Apache HTTP server access log, completely unrelated to Kubernetes node components.

570
MCQmedium

You run 'kubectl get pods' and see some pods in 'ImagePullBackOff' state. Which command would best help identify the root cause?

A.kubectl logs <pod-name>
B.kubectl describe pod <pod-name>
C.kubectl get events --field-selector involvedObject.kind=Pod
D.kubectl exec <pod-name> -- cat /var/log/containers
AnswerB

`kubectl describe pod <pod-name>` is the correct command because it aggregates the container's current status (Waiting with reason ImagePullBackOff) and the recent pod Events, including the detailed error message from the container runtime, such as "Failed to pull image" with the specific registry response (e.g., "not found" or "unauthorized"). This single command shows the image name, the node, and a timestamped history of pull attempts, making it the fastest path to diagnose why the image pull failed.

Why this answer

`kubectl describe pod <pod-name>` provides detailed information about the pod, including the status of its containers, events, and error messages from the kubelet. For an `ImagePullBackOff` state, the `describe` output will show the exact reason for the image pull failure (e.g., invalid image name, registry authentication failure, or network issues) in the `Status` and `Events` sections, making it the most direct troubleshooting command.

Exam trap

CNCF often tests the misconception that `kubectl logs` can retrieve startup errors, but in `ImagePullBackOff`, the container never runs, so logs are unavailable and `describe pod` is the correct tool to inspect the kubelet's event stream and container status.

Why the other options are wrong

A

The pod has not started, so there are no logs.

C

This would show events but not as detailed as describe pod; still acceptable but less direct.

D

Pod is not running; exec fails.

571
MCQeasy

Which command is used to mark a node as unschedulable and evict its pods?

A.kubectl delete node node-name
B.kubectl cordon node-name
C.kubectl drain node-name --ignore-daemonsets
D.kubectl taint node node-name key=value:NoSchedule
AnswerC

This is the correct command because it first cordons the node to prevent new scheduling and then safely evicts all active pods to other nodes in the cluster. The --ignore-daemonsets flag is required because DaemonSet-managed pods cannot be rescheduled elsewhere and would otherwise block the drain operation from completing.

Why this answer

`kubectl drain` marks a node as unschedulable (similar to `cordon`) and then evicts all pods from the node, respecting PodDisruptionBudgets. The `--ignore-daemonsets` flag is required because DaemonSet pods cannot be evicted via drain (they are managed by the DaemonSet controller and would be immediately rescheduled on the same node), so the command would fail without this flag.

Exam trap

CNCF often tests the distinction between `cordon` (only prevents scheduling) and `drain` (prevents scheduling AND evicts pods), and candidates frequently pick `cordon` because they forget that eviction is required for the node to be truly empty for maintenance.

How to eliminate wrong answers

Option A is wrong because `kubectl delete node` removes the node object from the cluster entirely, which does not evict pods gracefully and is not the intended way to perform maintenance. Option B is wrong because `kubectl cordon` only marks the node as unschedulable (prevents new pods from being scheduled) but does not evict existing pods. Option D is wrong because `kubectl taint` with `NoSchedule` prevents new pods from being scheduled on the node but does not evict existing pods; it also does not mark the node as unschedulable in the same way as `cordon` or `drain`.

572
MCQhard

You need to allow a pod to use a specific device from the host node (e.g., /dev/sdb) as a raw block device. Which volume mode should you set in the PVC?

A.Device
B.Raw
C.Block
D.Filesystem
AnswerC

Setting volumeMode: Block on a volume causes Kubernetes to present the backing storage as an unformatted raw block device inside the container. You must attach it through the container's volumeDevices list, providing a devicePath (e.g., /dev/xvdb), rather than using volumeMounts and a mountPath. This is required for workloads such as databases or storage engines that manage their own on-disk layout and want to bypass the filesystem layer entirely. Only Block mode supports this raw device access model.

Why this answer

To use a host device like /dev/sdb as a raw block device inside a pod, the PersistentVolumeClaim (PVC) must specify `volumeMode: Block`. This tells Kubernetes to expose the volume as a raw block device (e.g., /dev/xxx) inside the container, rather than mounting a filesystem. Only the `Block` volume mode supports this behavior, as defined in the Kubernetes PersistentVolume API.

Exam trap

The trap here is that candidates confuse the 'Block' volume mode with the deprecated 'Raw' or 'Device' terminology from other systems, or assume 'Filesystem' is the only option, missing that raw block access requires explicit mode selection.

How to eliminate wrong answers

Option A is wrong because 'Device' is not a valid volume mode in Kubernetes; the valid modes are 'Filesystem' and 'Block'. Option B is wrong because 'Raw' is not a recognized volume mode; the correct term is 'Block' for raw block device access. Option D is wrong because 'Filesystem' is the default volume mode, which mounts a filesystem (e.g., ext4) and does not expose the device as a raw block device.

573
MCQhard

You want to check the current resource usage (CPU and memory) of pods in the 'default' namespace. Which kubectl command should you use?

A.kubectl get pods -o wide
B.kubectl top pods
C.kubectl logs pods
D.kubectl describe pods
AnswerB

`kubectl top pods` is the correct command to view current resource usage. It queries the Metrics API, typically served by metrics-server, which aggregates per-container CPU and memory data from kubelet/cAdvisor. The output shows values like CPU in cores or millicores and memory in bytes or mebibytes, giving an accurate snapshot of live consumption. However, it depends on metrics-server being deployed in the cluster.

Why this answer

`kubectl top pods` retrieves real-time CPU and memory metrics for pods from the metrics server, which is the standard way to check current resource usage in a Kubernetes cluster. This command relies on the Metrics API and requires the metrics server to be deployed.

Exam trap

The trap here is that candidates often confuse `kubectl get pods -o wide` or `kubectl describe pods` with resource monitoring, but neither provides live CPU/memory metrics, which only `kubectl top` (with the metrics server) can deliver.

How to eliminate wrong answers

Option A is wrong because `kubectl get pods -o wide` only shows pod IPs and node assignments, not CPU or memory usage. Option C is wrong because `kubectl logs pods` fetches container logs, not resource metrics. Option D is wrong because `kubectl describe pods` provides detailed pod configuration and status but does not include live CPU or memory utilization data.

574
MCQeasy

You are setting up a new Kubernetes cluster using kubeadm. After running 'kubeadm init', you want to start using the cluster with kubectl. Which of the following commands should you run to configure kubectl for the admin user?

A.mkdir -p $HOME/.kube && sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config && sudo chown $(id -u):$(id -g) $HOME/.kube/config
B.sudo kubeadm reset --force
C.sudo cp /etc/kubernetes/admin.conf /root/.kube/config
D.sudo cp /etc/kubernetes/pki/admin.conf $HOME/.kube/config
AnswerA

This is the correct sequence: `mkdir -p $HOME/.kube` ensures the default kubeconfig directory exists, `sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config` copies the cluster-admin kubeconfig generated by kubeadm into the current user's home, and `sudo chown $(id -u):$(id -g) $HOME/.kube/config` makes the file readable/writable by the current user. Because the admin.conf file is owned by root (readable only by root), sudo is required for the copy; without the chown, kubectl would fail to read the kubeconfig. The resulting `~/.kube/config` is discovered automatically by kubectl, granting full cluster-admin privileges to the local user.

Why this answer

After running 'kubeadm init', the admin kubeconfig file is generated at /etc/kubernetes/admin.conf. To use kubectl as a regular (non-root) user, you must copy this file to the user's $HOME/.kube/config directory and then change its ownership to the current user. This ensures kubectl can authenticate to the cluster using the admin certificate and key embedded in the config file.

Exam trap

The trap here is that candidates might mistakenly copy the admin.conf to /root/.kube/config (option C) thinking it works for any user, or confuse the admin.conf location with the pki directory (option D), while the correct approach requires copying to the current user's home directory and fixing ownership.

How to eliminate wrong answers

Option B is wrong because 'kubeadm reset --force' is used to tear down a cluster or reinitialize it, not to configure kubectl; running it would destroy the cluster state. Option C is wrong because it copies the admin.conf to /root/.kube/config, which only configures kubectl for the root user, not for the current admin user; the CKA environment typically expects non-root usage. Option D is wrong because it references /etc/kubernetes/pki/admin.conf, which does not exist — the admin kubeconfig is located at /etc/kubernetes/admin.conf, not in the pki directory.

575
MCQhard

You have three pods selected by a service. One pod is in 'CrashLoopBackOff' state. How does the service's endpoints behave?

A.The service removes all endpoints to avoid partial connectivity
B.The service endpoints include only the two healthy pods
C.The service endpoints include the unhealthy pod but traffic is not routed to it
D.The service includes all three pods in its endpoints
AnswerB

The Endpoints object for a Service contains only the IP addresses of Pods that are currently Ready — that is, passing their readiness probes. Since two of the three Pods are healthy, the Service's Endpoints (or EndpointSlices) list exactly those two Pod IPs, and the ClusterIP load balances only to them.

Why this answer

B is correct because Kubernetes services use endpoints (or endpoint slices) to track which pods are ready to receive traffic. The readiness probe determines pod readiness; a pod in CrashLoopBackOff fails its readiness probe, so it is removed from the service's endpoints. Only the two healthy pods remain in the endpoint list, ensuring traffic is routed only to healthy pods.

Exam trap

CNCF often tests the misconception that a service will still include an unhealthy pod in its endpoints but simply not route traffic to it, whereas in reality the endpoint controller removes the pod entirely from the endpoint list based on readiness probe failures.

How to eliminate wrong answers

Option A is wrong because the service does not remove all endpoints; it only removes the unhealthy pod, preserving connectivity via the healthy pods. Option C is wrong because the service endpoints do not include the unhealthy pod; the endpoint controller removes pods that fail readiness probes, so the pod is not present in the endpoint list at all. Option D is wrong because the service does not include all three pods; the CrashLoopBackOff pod is excluded from endpoints due to its failed readiness probe.

576
MCQeasy

Which component is responsible for assigning pods to nodes?

A.kube-scheduler
B.kubelet
C.kube-apiserver
D.kube-controller-manager
AnswerA

kube-scheduler is the control plane component that selects the optimal node for each newly created pod. It subscribes to the API server's watch stream for pending pods, filters nodes according to resource requirements, taints/tolerations, node selectors, and affinity rules, then scores the feasible candidates to choose the best match. The decision is written back as a binding object, which sets the pod's nodeName field, so this component alone is responsible for assigning pods to nodes.

Why this answer

The kube-scheduler is responsible for assigning pods to nodes based on resource requirements, constraints, and policies. It watches for newly created pods that have no node assignment and selects an optimal node for each pod to run on.

Exam trap

The trap here is that candidates often confuse the kubelet's role of running pods with the scheduler's role of assigning pods to nodes, or think the API server handles scheduling because it processes pod creation requests.

How to eliminate wrong answers

Option B is wrong because kubelet is the agent that runs on each node and ensures containers are running in a pod, but it does not decide which node a pod should be scheduled on. Option C is wrong because kube-apiserver is the front-end for the Kubernetes control plane and handles API requests, but it does not perform scheduling decisions. Option D is wrong because kube-controller-manager runs controller processes like replication controller and node controller, but pod-to-node assignment is the scheduler's responsibility.

577
Multi-Selectmedium

Which TWO are true about taints and tolerations? (Select 2)

Select 2 answers
A.Taints prevent all pods from scheduling on a node
B.A node can have multiple taints
C.Taints are applied to pods
D.Tolerations are set on nodes
E.Tolerations allow pods to schedule on tainted nodes
AnswersB, E

A node can have multiple taints in its spec.taints list, each defined by a key, value, and effect (NoSchedule, PreferNoSchedule, or NoExecute). For a pod to be schedulable, it must tolerate every taint present on the node; if any taint lacks a matching toleration, the pod will not be scheduled there. This allows fine-grained control over node isolation.

Why this answer

Option B is correct because a Kubernetes node can carry multiple taints simultaneously, each expressed as key=value:effect, and a pod must tolerate every NoSchedule/NoExecute taint on that node to be scheduled there. Option E is correct because tolerations are declared in a pod's spec (spec.tolerations) and let the scheduler place that pod on a node whose taints it matches, effectively overriding the taint's scheduling restriction. Option A is wrong because taints only repel pods that lack matching tolerations, not all pods; pods with appropriate tolerations can still schedule.

Option C is wrong because taints are applied to nodes (via kubectl taint nodes), not to pods. Option D is wrong because tolerations are set on pods, not on nodes.

Exam trap

The trap here is that candidates often confuse which object (node vs. pod) receives taints versus tolerations, leading them to incorrectly select options C or D.

578
MCQeasy

Which command retrieves logs from a container that has crashed and restarted?

A.kubectl describe pod pod-name
B.kubectl logs pod-name --previous
C.kubectl logs pod-name -c container-name
D.kubectl logs pod-name --tail=100
AnswerB

kubectl logs pod-name --previous retrieves the log output from the previous instantiation of the container in the same pod. When a container crashes and restarts, the kubelet replaces its log file, so the current logs only contain output from the new, possibly healthy instance. The --previous flag accesses the log file of the terminated container, making it the correct way to see the crash-related output.

Why this answer

B is correct because the `--previous` flag in `kubectl logs` retrieves logs from the previous instance of a container that has crashed and restarted. When a container restarts, its logs are preserved for the terminated instance, and this flag allows you to access those logs to debug the crash. Without `--previous`, you would only see logs from the currently running container.

Exam trap

The trap here is that candidates often confuse `kubectl logs` with `kubectl describe` or think that `--tail` or `-c` can retrieve logs from a crashed container, when only `--previous` accesses the terminated instance's logs.

How to eliminate wrong answers

Option A is wrong because `kubectl describe pod` shows metadata, events, and status of the pod, but does not retrieve container logs. Option C is wrong because `-c container-name` specifies a container within a multi-container pod, but does not access logs from a previous, crashed instance. Option D is wrong because `--tail=100` limits the number of log lines shown from the current container, not from a previous crashed instance.

579
MCQmedium

A cluster administrator creates a StorageClass with the following YAML: apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: fast provisioner: kubernetes.io/aws-ebs parameters: type: gp2 reclaimPolicy: Delete volumeBindingMode: Immediate A developer creates a PVC using this StorageClass. The PVC is created and remains in Pending state. What is the most likely cause?

A.The volumeBindingMode is Immediate, which requires a different access mode.
B.The cluster is not running on AWS or the AWS cloud provider is not configured.
C.The PVC does not specify an access mode.
D.The reclaim policy is Delete, which prevents binding.
AnswerB

The `kubernetes.io/aws-ebs` provisioner is specifically designed to interact with the AWS EC2 API to create EBS volumes. For this provisioner to function correctly, the Kubernetes cluster must be running within an AWS environment, and the `kube-controller-manager` must be configured with the AWS cloud provider integration. If the cluster is not on AWS, or if the cloud provider integration is misconfigured or missing, the provisioner cannot authenticate or make API calls to AWS, leading to the PVC remaining in a `Pending` state indefinitely as it cannot provision the underlying storage.

Why this answer

The StorageClass uses the provisioner `kubernetes.io/aws-ebs`, which is specific to the AWS cloud provider. If the cluster is not running on AWS or the AWS cloud provider is not properly configured (e.g., missing IAM roles, cloud-controller-manager not running), the provisioner cannot create the underlying EBS volume, leaving the PVC in a Pending state indefinitely.

Exam trap

The trap here is that candidates may focus on PVC spec details like access modes or reclaim policies, but the core issue is that the provisioner is incompatible with the underlying infrastructure, which is a common real-world misconfiguration tested in the CKA Storage domain.

How to eliminate wrong answers

Option A is wrong because `volumeBindingMode: Immediate` does not require a specific access mode; it simply means binding and provisioning happen as soon as the PVC is created, regardless of pod scheduling. Option C is wrong because the PVC can still be created and bound even if it does not specify an access mode; the access mode is a required field in the PVC spec, but its absence would cause a validation error, not a Pending state after creation. Option D is wrong because the `reclaimPolicy: Delete` does not prevent binding; it only determines what happens to the PV when the PVC is deleted, and has no effect on the initial binding process.

580
Multi-Selecthard

A pod is in 'CrashLoopBackOff' state. Which THREE of the following are possible causes?

Select 3 answers
A.The container's startup command has invalid arguments
B.The container image does not exist
C.The application tries to bind to a port that is already in use
D.The PersistentVolumeClaim is not bound
E.A required environment variable is not set
AnswersA, C, E

A container whose startup command includes invalid arguments (for example, a misspelled flag, undefined positional parameter, or a file path that does not exist) causes the runtime to launch the process only for it to exit immediately with a non-zero exit code. Because the process fails before it can do meaningful work, the kubelet sees a completed/error container and applies the restartPolicy, which rapidly restarts it and transitions to CrashLoopBackOff. The backoff timer doubles on each restart, but the underlying command flaw remains, so the crash loop persists until the arguments are corrected.

Why this answer

Option A is correct because if the container's startup command (ENTRYPOINT/CMD) contains invalid arguments, the process exits immediately with a non-zero code, causing kubelet to restart it repeatedly and enter CrashLoopBackOff. Option C is correct because if the application attempts to bind to a port already in use inside the container, it fails at startup and exits, triggering the same restart loop. Option E is correct because a missing required environment variable typically causes the application to fail fast during initialization, again producing repeated crashes.

Option B is not a CrashLoopBackOff cause: a nonexistent image results in an ImagePullBackOff or ErrImagePull state, since the container never starts. Option D is also not correct: an unbound PVC leaves the pod stuck in Pending (or ContainerCreating) due to an unschedulable volume, not in CrashLoopBackOff.

Exam trap

The CKA exam often tests the distinction between CrashLoopBackOff and ImagePullBackOff, where candidates confuse image-related issues (like a missing image) with application-level startup failures that cause the container to crash.

581
MCQmedium

A developer wants to run a one-time batch job that processes data and then exits. Which Kubernetes resource should be used?

A.DaemonSet
B.CronJob
C.Deployment
D.Job
AnswerD

A Kubernetes Job creates one or more pods and ensures that a specified number of them successfully terminate, tracking the overall completion. It is the ideal controller for a one-time batch task because the pod runs to completion and the Job status becomes Complete, without any automatic restart of the finished pod. If the pod fails, the Job can restart it according to the backoffLimit, ensuring the task eventually succeeds.

Why this answer

A Job is the correct Kubernetes resource for a one-time batch task that runs to completion and then exits. It ensures a specified number of Pods terminate successfully, making it ideal for processing data and exiting without requiring continuous availability.

Exam trap

The trap here is that candidates often confuse a CronJob with a Job, assuming any batch-like task requires scheduling, but the question explicitly says 'one-time,' which eliminates the need for a schedule.

How to eliminate wrong answers

Option A is wrong because a DaemonSet ensures that a copy of a Pod runs on all (or a subset of) nodes, providing continuous background services like logging or monitoring, not a one-time batch job. Option B is wrong because a CronJob is used for scheduling recurring tasks at specified times (e.g., every hour), not for a single execution. Option C is wrong because a Deployment manages a set of replica Pods intended to run indefinitely, maintaining a desired state with rolling updates, not a finite task that exits.

582
MCQmedium

You want to dynamically provision storage for a PVC using a StorageClass named 'fast-ssd'. Which field in the PVC YAML specifies the StorageClass?

A.class
B.storageClass
C.className
D.storageClassName
AnswerD

The field storageClassName is the correct, canonical way to reference a StorageClass in a PersistentVolumeClaim. It tells the Kubernetes scheduler which StorageClass should be used to dynamically provision a PersistentVolume for this claim. If the StorageClass exists and is available, the provisioner associated with it creates the underlying storage, and the PV is bound to the PVC. If storageClassName is not specified, the cluster's default StorageClass is used, but explicit specification ensures the desired class is selected. This field is part of the PVC spec and is crucial for controlling storage characteristics like performance, reclaim policy, and provisioner.

Why this answer

In Kubernetes, the field that specifies which StorageClass to use for dynamic provisioning in a PersistentVolumeClaim (PVC) is `storageClassName`. When this field is set to a valid StorageClass name (e.g., 'fast-ssd'), the system will dynamically provision a PersistentVolume using the provisioner and parameters defined in that StorageClass. If omitted, the default StorageClass (if one exists) is used.

Exam trap

The trap here is that candidates often confuse the field name `storageClassName` with similar-sounding terms like `storageClass` or `className`, or they assume a generic `class` field exists, leading them to pick a plausible but incorrect option.

How to eliminate wrong answers

Option A is wrong because `class` is not a valid field in a PVC spec; it is a legacy term from earlier versions and is not recognized by the Kubernetes API. Option B is wrong because `storageClass` (camelCase) is not the correct field name; the API uses `storageClassName` (all lowercase with 'Name' appended). Option C is wrong because `className` is not a field in the PVC spec; it might be confused with a field in other Kubernetes resources (e.g., Ingress) but does not apply to PVCs.

583
MCQeasy

Which component is responsible for running containers on a node and reporting their status to the control plane?

A.kubelet
B.container runtime (e.g., containerd)
C.kube-proxy
D.kube-scheduler
AnswerA

As the primary node agent, the kubelet is responsible for ensuring that containers described in PodSpecs are running and healthy on its node. It acts as the bridge between the control plane and the container runtime, translating declarative pod specifications into runtime commands via the Container Runtime Interface (CRI).

Why this answer

The kubelet is the primary node agent that runs on every node in a Kubernetes cluster. It is responsible for ensuring that containers are running in a Pod as expected, by interacting with the container runtime (e.g., containerd) to start, stop, and monitor containers. The kubelet then reports the status of the node and its Pods back to the control plane via the Kubernetes API server, using heartbeats (NodeStatus updates) and Pod status updates.

Exam trap

The trap here is that candidates often confuse the container runtime with the kubelet, because both are involved in running containers, but the kubelet is the agent that reports status to the control plane, while the runtime only executes containers locally.

How to eliminate wrong answers

Option B (container runtime) is wrong because the container runtime (e.g., containerd, CRI-O) is responsible for actually pulling images and managing container lifecycle, but it does not report status to the control plane; the kubelet communicates with the runtime via the CRI (Container Runtime Interface) and then reports to the API server. Option C (kube-proxy) is wrong because kube-proxy is a network proxy that runs on each node, handling network rules for Services (e.g., iptables/IPVS), but it does not manage containers or report their status to the control plane. Option D (kube-scheduler) is wrong because the kube-scheduler runs on the control plane (or master node) and is responsible for assigning Pods to nodes based on resource availability and constraints; it does not run on worker nodes and does not report container status.

584
MCQeasy

A developer wants to mount a ConfigMap as a volume in a pod. However, the pod should only see specific keys from the ConfigMap, not all keys. What is the best approach?

A.Use the ConfigMap to set environment variables instead of a volume mount.
B.Use the 'items' field in the ConfigMap volume definition to specify which keys to include.
C.Mount the entire ConfigMap and use a startup script to remove unwanted files.
D.Create a new ConfigMap with only the needed keys.
AnswerB

The `items` field within a ConfigMap volume definition is the precise and recommended method for selectively exposing specific keys as files inside a container. By specifying `key` and `path` for each desired entry, only the relevant data from the ConfigMap is mounted into the pod's filesystem, preventing unnecessary data exposure. This approach ensures minimal resource usage and adheres to the principle of least privilege by only providing what is strictly required. For example, `items: [{key: "app-config.yaml", path: "config.yaml"}]` mounts only the `app-config.yaml` key as `config.yaml`.

Why this answer

The `items` field in a ConfigMap volume definition allows you to selectively project only specific keys from the ConfigMap into the pod's filesystem. This is the native Kubernetes mechanism for controlling which keys appear as files, avoiding the need to mount the entire ConfigMap or create a separate ConfigMap.

Exam trap

The trap here is that candidates often confuse the `items` field with the `optional` field or assume that mounting a ConfigMap always exposes all keys, leading them to choose the wasteful approach of creating a new ConfigMap (Option D) instead of using the built-in selective projection mechanism.

How to eliminate wrong answers

Option A is wrong because using environment variables is a different mechanism that does not address the requirement to mount a ConfigMap as a volume; it also exposes all keys as environment variables unless you manually specify each key, which is not the best approach for selective file projection. Option C is wrong because mounting the entire ConfigMap and then using a startup script to remove unwanted files is an anti-pattern that wastes resources, adds complexity, and violates the principle of declarative configuration. Option D is wrong because creating a new ConfigMap with only the needed keys duplicates data and increases management overhead, whereas the `items` field achieves the same goal without creating additional objects.

585
MCQmedium

An administrator creates a ServiceAccount named 'monitor' in the 'default' namespace. They want any pod using this ServiceAccount to be able to list pods cluster-wide. Which RBAC resource should be created and bound to this ServiceAccount?

A.ClusterRole and RoleBinding in the default namespace
B.ClusterRole and RoleBinding in kube-system
C.ClusterRole and ClusterRoleBinding
D.Role and RoleBinding in the default namespace
AnswerC

To grant cluster-wide permissions to a ServiceAccount, you must pair a ClusterRole with a ClusterRoleBinding. Because a ClusterRoleBinding is a non-namespaced resource, it applies the permissions defined in the ClusterRole across all namespaces in the cluster, as well as to cluster-scoped resources like Nodes and PersistentVolumes.

Why this answer

A ClusterRole is required because listing pods cluster-wide is a cluster-scoped operation, not limited to a single namespace. A ClusterRoleBinding is needed to bind the ClusterRole to the ServiceAccount 'monitor' at the cluster level, granting permissions across all namespaces. RoleBindings can only grant permissions within a single namespace, so they cannot achieve cluster-wide access.

Exam trap

The trap here is that candidates often confuse namespace-scoped RoleBindings with cluster-scoped ClusterRoleBindings, assuming a RoleBinding can grant cluster-wide permissions if the Role is a ClusterRole, but the binding type determines the scope of the grant.

How to eliminate wrong answers

Option A is wrong because a RoleBinding can only grant permissions within the namespace where it is created, so it cannot provide cluster-wide pod listing. Option B is wrong because a RoleBinding in kube-system would only grant permissions within the kube-system namespace, not cluster-wide. Option D is wrong because both a Role and a RoleBinding are namespace-scoped, limiting the ServiceAccount to only the default namespace.

586
MCQhard

You need to create a ServiceAccount named 'deployer' and grant it permission to create Deployments in namespace 'app'. Which YAML snippet correctly creates the necessary RBAC resources?

A.apiVersion: v1 kind: ServiceAccount metadata: name: deployer namespace: app --- kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: name: deployer namespace: app rules: - apiGroups: ["apps"] resources: ["deployments"] verbs: ["create"] --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: deployer namespace: app subjects: - kind: ServiceAccount name: deployer namespace: app roleRef: kind: Role name: deployer apiGroup: rbac.authorization.k8s.io
B.kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: deployer rules: - apiGroups: ["apps"] resources: ["deployments"] verbs: ["create"] --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: deployer subjects: - kind: ServiceAccount name: deployer namespace: app roleRef: kind: ClusterRole name: deployer apiGroup: rbac.authorization.k8s.io
C.apiVersion: v1 kind: ServiceAccount metadata: name: deployer namespace: app --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: deployer rules: - apiGroups: ["apps"] resources: ["deployments"] verbs: ["create"] --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: deployer namespace: app subjects: - kind: ServiceAccount name: deployer namespace: app roleRef: kind: ClusterRole name: deployer apiGroup: rbac.authorization.k8s.io
D.apiVersion: v1 kind: ServiceAccount metadata: name: deployer namespace: app --- kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: name: deployer namespace: default rules: - apiGroups: ["apps"] resources: ["deployments"] verbs: ["create"] --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: deployer namespace: app subjects: - kind: ServiceAccount name: deployer namespace: app roleRef: kind: Role name: deployer apiGroup: rbac.authorization.k8s.io
AnswerA

This is the correct solution as it precisely meets the requirements. It creates a `ServiceAccount` named `deployer` in the `app` namespace. A `Role` is then defined in the `app` namespace, granting the specific permission to create `deployments`. Finally, a `RoleBinding` in the `app` namespace associates this namespaced `Role` with the `deployer` `ServiceAccount`, ensuring permissions are confined strictly to the 'app' namespace.

Why this answer

It creates a ServiceAccount named 'deployer' in the 'app' namespace, a Role in the same namespace with rules allowing 'create' on 'deployments' (which belong to the 'apps' API group), and a RoleBinding that binds the ServiceAccount to that Role. This grants the ServiceAccount permission to create Deployments only within the 'app' namespace, which is the required scope.

Exam trap

A common pitfall is the misconception that a RoleBinding can only bind a Role, but in fact a RoleBinding can bind a ClusterRole, granting the ClusterRole's permissions only within the RoleBinding's namespace. Therefore, option C is technically valid and would also satisfy the requirement. However, the exam's expected answer is option A because it uses a namespaced Role, adhering to the principle of least privilege.

Option B is incorrect because it uses a ClusterRoleBinding, which grants permissions cluster-wide. Option D is incorrect because the Role is created in the 'default' namespace instead of 'app'.

How to eliminate wrong answers

Option B is wrong because it uses a ClusterRole and ClusterRoleBinding, which grant permissions cluster-wide (across all namespaces), not just in the 'app' namespace as required. Option C is wrong because it uses a ClusterRole with a RoleBinding; while a RoleBinding can reference a ClusterRole, the binding itself is namespaced, but the ClusterRole's scope is still cluster-wide, which is unnecessarily broad and not the minimal required RBAC for a single namespace. Option D is wrong because the Role is defined in the 'default' namespace, not in the 'app' namespace, so the RoleBinding in 'app' cannot reference a Role from a different namespace; Role and RoleBinding must be in the same namespace.

587
MCQhard

You have a PriorityClass 'high-priority' with value 1000 and 'low-priority' with value 100. A pod A with 'high-priority' is pending because the node has no resources. A pod B with 'low-priority' is running on that node. What will happen if preemption is enabled?

A.Pod A will be scheduled only after pod B completes its work
B.Pod A will remain pending because preemption is not enabled by default
C.The cluster administrator must manually delete pod B to allow pod A to schedule
D.Pod B will be preempted (evicted) to allow pod A to be scheduled on the node
AnswerD

This is the correct behavior. When Pod A, possessing a higher priority, cannot find a node with sufficient available resources, the kube-scheduler will identify a node where Pod B (a lower-priority pod) is running and whose eviction would free up the necessary resources. The scheduler then initiates the preemption process, which involves evicting Pod B from that node. This action frees up the required resources, allowing Pod A to be successfully scheduled and started on the now-available node.

Why this answer

When preemption is enabled, the Kubernetes scheduler can evict lower-priority pods to free resources for pending higher-priority pods. In this scenario, Pod A (priority 1000) is pending due to insufficient resources, while Pod B (priority 100) is running on the node. The scheduler will preempt (evict) Pod B to allow Pod A to be scheduled, as the priority difference is significant and preemption is enabled by default in Kubernetes (via the 'PrioritySort' and 'Preemption' plugins).

Exam trap

The trap here is that candidates often assume preemption requires manual configuration or is disabled by default, but Kubernetes enables preemption by default in the scheduler, and the scheduler automatically handles eviction without administrator intervention.

How to eliminate wrong answers

Option A is wrong because preemption does not wait for the lower-priority pod to complete; it actively evicts it to schedule the higher-priority pod. Option B is wrong because preemption is enabled by default in Kubernetes (the 'Preemption' plugin is active in the default scheduler configuration), so Pod A will not remain pending if a lower-priority pod can be evicted. Option C is wrong because the scheduler automatically handles preemption without manual intervention from the cluster administrator.

588
Multi-Selectmedium

Which TWO of the following are required fields in a PersistentVolumeClaim spec? (Select TWO)

Select 2 answers
A.storageClassName
B.selector
C.accessModes
D.volumeMode
E.resources.requests.storage
AnswersC, E

accessModes is a mandated field for both PersistentVolumes and PersistentVolumeClaims, and it must contain at least one valid access mode such as ReadWriteOnce, ReadOnlyMany, or ReadWriteMany. Kubernetes uses these modes to enforce how many nodes can mount the volume and whether it can be mounted read-only. Without this field, the API server will reject the claim because there is no way to determine the volume's intended access semantics.

Why this answer

Option C (accessModes) is correct because a PersistentVolumeClaim must declare how the volume will be mounted (e.g., ReadWriteOnce, ReadOnlyMany, ReadWriteMany), and this field is mandatory in the PVC spec. Option E (resources.requests.storage) is correct because the claim must specify the amount of storage it requests (e.g., 5Gi), which the control plane uses to bind a matching PersistentVolume. Option A (storageClassName) is not required since it can be omitted, in which case the default StorageClass is used or binding falls back to matching without a class.

Option B (selector) is optional and only used to further constrain which PersistentVolumes can satisfy the claim via label matching. Option D (volumeMode) is optional and defaults to Filesystem when not specified.

Exam trap

The trap here is that candidates often assume `storageClassName` is required because it is commonly used, but the CKA exam tests that only `accessModes` and `resources.requests.storage` are mandatory per the Kubernetes API spec.

589
MCQhard

A pod remains in Pending state. You run 'kubectl describe pod mypod' and see the following event: '0/3 nodes are available: 2 node(s) had taint {node-role.kubernetes.io/control-plane: }, that the pod didn't tolerate, 1 node(s) didn't match pod anti-affinity rules.' What is the best action to schedule the pod?

A.Increase the number of replicas
B.Modify the pod's anti-affinity rules or remove the conflicting pod on the third node
C.Remove the node.kubernetes.io/control-plane taint from the control plane nodes
D.Add a toleration for the control-plane taint to the pod spec
AnswerB

The `podAntiAffinity` rule explicitly prevents a pod from being scheduled on a node that already hosts another pod matching specific labels within a defined topology domain. If the `kubectl describe po` output indicates an anti-affinity conflict on the third node, either relaxing the `podAntiAffinity` rule in the pod's specification or removing the existing, conflicting pod from that node would allow the pending pod to be scheduled. This directly resolves the constraint preventing the pod from finding a suitable node.

Why this answer

The pod is unschedulable because one node has a pod anti-affinity rule conflict, and the other two nodes have a control-plane taint. The best action is to modify the pod's anti-affinity rules (e.g., relax the requiredDuringSchedulingIgnoredDuringExecution constraint) or remove the conflicting pod on the third node, as this directly resolves the scheduling conflict without affecting the control-plane taint or replicas.

Exam trap

The trap here is that candidates often focus on the taint issue (options C or D) because it appears first in the event message, but they overlook the anti-affinity conflict on the third node, which is the actual blocking constraint for that node.

How to eliminate wrong answers

Option A is wrong because increasing the number of replicas does not resolve the underlying scheduling constraints—it only creates more pods that will also remain Pending. Option C is wrong because removing the control-plane taint from control plane nodes is not recommended; those nodes are typically reserved for system components and removing the taint could lead to resource contention or security issues. Option D is wrong because adding a toleration for the control-plane taint would only address the taint issue on two nodes, but the pod would still fail to schedule on the third node due to the anti-affinity conflict.

590
Multi-Selectmedium

Which THREE of the following are characteristics of a StatefulSet? (Select 3)

Select 3 answers
A.Pods are started and terminated in a controlled order (sequentially)
B.Each pod can have its own persistent volume claim (PVC)
C.Pods are automatically distributed across all nodes in the cluster
D.StatefulSets require a ClusterIP service for stable network identities
E.Each pod has a unique, stable network identity (e.g., web-0, web-1)
AnswersA, B, E

With the default podManagementPolicy of OrderedReady, a StatefulSet creates or terminates pod replicas one at a time in strict ordinal order. When scaling up, each pod must become Ready before the next is started; when scaling down or deleting, pods are removed from the highest ordinal back to the lowest, waiting for each deletion to complete. This controlled sequencing lets distributed applications bootstrap or shut down in a predictable, deterministic manner instead of all replicas launching simultaneously.

Why this answer

Option A is correct because a StatefulSet creates and deletes pods in a strict ordinal sequence (0, 1, 2, ... for creation and reverse order for termination), which is essential for stateful workloads that need ordered startup/shutdown. Option B is correct because StatefulSets use volumeClaimTemplates to give each replica its own PersistentVolumeClaim, so every pod gets dedicated storage that persists across rescheduling. Option E is correct because each pod in a StatefulSet receives a stable, unique hostname derived from the StatefulSet name plus ordinal index (e.g., web-0, web-1), backed by a governing headless Service.

Option C is not a StatefulSet characteristic; pod placement across nodes is handled by the scheduler for all workload types, not specifically by StatefulSets. Option D is inaccurate because stable network identities require a headless Service (clusterIP: None), not a regular ClusterIP Service.

Exam trap

The trap here is that candidates often confuse a Headless Service with a regular ClusterIP Service, mistakenly thinking a ClusterIP Service is required for stable network identities, when in fact a Headless Service is mandatory for StatefulSets.

591
MCQmedium

A pod is stuck in Pending state. Running 'kubectl describe pod mypod' reveals the event '0/4 nodes are available: 3 Insufficient memory, 1 node(s) had taints that the pod didn't tolerate'. What is the most likely cause?

A.The pod requests more memory than available on any node and does not tolerate a node taint
B.The kubelet on all nodes is not running
C.The pod's container image is not pullable
D.The pod is using a hostPort that conflicts with an existing pod
AnswerA

The events described are exactly what kubectl describe pod would show when the kube-scheduler cannot find a feasible node: a combination of 'Insufficient memory' (the pod's resource requests exceed allocatable memory on every node) and 'node(s) had untolerated taint' (the pod lacks a matching toleration for a taint applied to candidate nodes). Since the scheduler must satisfy both the resource request/limit check and the taint/toleration rule before binding, the pod is never assigned and remains Pending. This is a scheduling failure, not a runtime issue.

Why this answer

The pod is pending because no node can satisfy its resource requirements or tolerate the node taints. The event indicates insufficient memory and a taint issue. The correct answer is that the pod requests more memory than any node can allocate and also does not tolerate a node taint.

592
MCQeasy

Which component on a worker node is responsible for maintaining network rules and enabling service abstraction?

A.kube-scheduler
B.kube-proxy
C.container runtime
D.kubelet
AnswerB

kube-proxy runs on every worker node and is responsible for implementing the Kubernetes Service abstraction by maintaining network rules that govern traffic forwarding to backend pods. It watches the API server for Service and Endpoint changes and programs iptables, IPVS, or userspace rules to route packets correctly. This directly matches the task of maintaining network rules on a worker node, making it the correct answer.

Why this answer

kube-proxy is the component on each worker node that maintains network rules (e.g., iptables, IPVS) and enables service abstraction by proxying traffic to the correct Pods. It watches the Kubernetes API server for Service and EndpointSlice changes, then updates the node's packet filtering rules to route cluster IP traffic to healthy backend Pods.

Exam trap

CNCF often tests the distinction between kubelet (Pod lifecycle) and kube-proxy (network rules), so the trap here is that candidates confuse kubelet's role in managing containers with the network abstraction provided by kube-proxy.

How to eliminate wrong answers

Option A is wrong because kube-scheduler runs on the control plane, not worker nodes, and is responsible for assigning Pods to nodes based on resource requirements, not for maintaining network rules or service abstraction. Option C is wrong because the container runtime (e.g., containerd, CRI-O) is responsible for pulling images and running containers, not for implementing network policies or proxying service traffic. Option D is wrong because kubelet is the primary node agent that manages Pod lifecycle (e.g., ensuring containers are running) and reports node status, but it does not handle network rule maintenance or service proxying.

593
Multi-Selectmedium

You are applying the following RBAC manifest: --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: namespace: development name: pod-reader rules: - apiGroups: [""] resources: ["pods"] verbs: ["get", "watch", "list"] Which TWO statements are true about this Role? (Choose TWO.)

Select 2 answers
A.It also grants access to secrets in the 'development' namespace
B.It allows reading pod details in the 'development' namespace
C.It grants permissions across all namespaces
D.It grants permissions only within the 'development' namespace
E.It allows creating pods in the 'development' namespace
AnswersB, D

This Role grants the verbs "get," "watch," and "list" for the "pods" resource, which are all read-only operations in Kubernetes RBAC. "get" retrieves a single pod's details, "list" enumerates pods, and "watch" streams pod changes. Because the rule is scoped to the development namespace via a Role and the verbs are read-only, this correctly describes the permission to read pod details in that namespace.

Why this answer

The Role explicitly defines rules for the 'pods' resource with verbs 'get', 'watch', and 'list' in the 'development' namespace. These verbs allow reading pod details such as their specifications, status, and metadata. The Role is scoped to the 'development' namespace, so it only grants these read permissions within that namespace.

Exam trap

The trap here is that candidates often confuse a Role with a ClusterRole, mistakenly thinking a Role can grant permissions across all namespaces, or they assume that granting access to 'pods' implicitly grants access to related resources like secrets or logs.

594
MCQmedium

A pod is in CrashLoopBackOff. You check the logs with 'kubectl logs my-pod --previous' and see 'Error: cannot connect to database at 10.0.0.1:3306'. The database service is named 'mysql' and runs on port 3306. What is the most likely cause?

A.The application is configured with an incorrect database hostname
B.The pod does not have network access to the mysql service
C.The mysql service is not exposed on port 3306
D.The database pod is not running
AnswerA

The application's logs clearly show an attempt to establish a database connection to the hardcoded IP address "10.0.0.1". In a Kubernetes environment, applications should typically connect to services using their DNS-resolvable service names (e.g., 'mysql' or 'mysql.default.svc.cluster.local') rather than static cluster IPs, which are ephemeral and subject to change. This misconfiguration prevents the application from correctly resolving and connecting to the intended 'mysql' service, leading to the CrashLoopBackOff.

Why this answer

The error message 'cannot connect to database at 10.0.0.1:3306' indicates the application is trying to connect to a hardcoded IP address (10.0.0.1) instead of the Kubernetes service name 'mysql'. In Kubernetes, services are accessed via DNS names (e.g., 'mysql.default.svc.cluster.local'), not static IPs, which are ephemeral and can change. This misconfiguration causes the connection failure, leading to the CrashLoopBackOff as the app repeatedly fails to start.

Exam trap

The trap here is that candidates assume the error is due to network connectivity or the database being down, but the specific mention of a hardcoded IP (10.0.0.1) in the logs points directly to an application configuration issue with the hostname, not a cluster-level network or service problem.

How to eliminate wrong answers

Option B is wrong because if the pod lacked network access to the mysql service, the error would typically be a timeout or 'no route to host', not a specific connection refusal to 10.0.0.1:3306; the pod can reach the IP but the database isn't listening there. Option C is wrong because the mysql service is explicitly stated to run on port 3306, and the error shows the app is attempting port 3306, so the port exposure is not the issue. Option D is wrong because if the database pod were not running, the service would have no endpoints, and the connection attempt would result in a 'connection refused' or timeout, but the error specifically mentions a hardcoded IP (10.0.0.1) rather than the service DNS name, indicating a configuration problem, not a pod status issue.

595
MCQeasy

A user creates a Deployment with replicas=3. Two Pods are running, but the third is stuck in ContainerCreating. 'kubectl describe pod' shows 'Failed to create pod sandbox: rpc error: code = Unknown desc = failed to create containerd task: OCI runtime create failed: container_linux.go:349: starting container process caused: exec: "/app": stat /app: no such file or directory'. What is the most likely cause?

A.The container image is not pulled due to authentication failure.
B.The container exceeds its memory limit and is killed.
C.The node is not schedulable due to taints.
D.The container image does not have the /app executable at the specified path.
AnswerD

When a container starts, the container runtime attempts to execute the command specified in the container's configuration. If the /app binary is missing from the image or the path is misconfigured, the runtime fails to spawn the process, resulting in a container creation or start failure with a 'no such file or directory' error.

Why this answer

The error message 'exec: "/app": stat /app: no such file or directory' indicates that the container runtime (containerd) successfully created the sandbox and started the container process, but the command specified in the container's entrypoint or command tried to execute '/app', which does not exist inside the container image. This is a classic misconfiguration where the image lacks the expected binary or script at the given path, causing the container to fail immediately after creation.

Exam trap

The trap here is that candidates may confuse a 'ContainerCreating' status with image pull issues or resource limits, but the specific OCI runtime exec error points directly to a missing executable in the container image, not to infrastructure or scheduling problems.

How to eliminate wrong answers

Option A is wrong because an authentication failure would produce an 'ImagePullBackOff' or 'ErrImagePull' status, not a 'ContainerCreating' state with an OCI runtime exec error. Option B is wrong because exceeding the memory limit results in an OOMKilled container (status 'OOMKilled'), not a failure to start the container process with a 'no such file or directory' error. Option C is wrong because taints cause the pod to remain in 'Pending' state (not 'ContainerCreating'), and the error message is about container runtime execution, not scheduling.

596
MCQhard

A pod is stuck in 'Pending' state. 'kubectl describe pod' shows '0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate'. What is the most likely cause?

A.The pod is missing resource requests.
B.The pod does not tolerate the node's taint.
C.The node is cordoned.
D.The kubelet is not running on the node.
AnswerB

The scheduler rejected every node because the control-plane node carries the `node-role.kubernetes.io/master:` taint with no matching toleration in the pod spec. Without a toleration for that specific key and effect, the scheduler cannot bind the pod, leaving it Pending indefinitely.

Why this answer

The pod is stuck in 'Pending' because the scheduler cannot find a node that satisfies its scheduling constraints. The 'kubectl describe pod' output explicitly states that 1 node has a taint (node-role.kubernetes.io/master) that the pod does not tolerate. By default, pods do not tolerate the master taint, so they are not scheduled onto master nodes unless a toleration is added.

This is the direct cause of the pending state.

Exam trap

The trap here is that candidates may confuse taints with node cordoning or resource constraints, but the specific error message about 'taint that the pod didn't tolerate' directly points to a toleration mismatch, not a resource or node readiness issue.

How to eliminate wrong answers

Option A is wrong because missing resource requests would cause the scheduler to fail with a different error message, such as 'Insufficient cpu' or 'Insufficient memory', not a taint-related message. Option C is wrong because a cordoned node would show 'node(s) were cordoned' or 'node(s) had taint node.kubernetes.io/unschedulable' in the describe output, not a taint about node-role.kubernetes.io/master. Option D is wrong because if the kubelet were not running, the node would show as 'NotReady' and the scheduler would report '0/1 nodes are available: 1 node(s) were not ready', not a taint-related message.

597
MCQeasy

To view the logs of a specific container in a multi-container pod named 'web-pod', which command is correct?

A.kubectl logs web-pod --all-containers
B.kubectl logs web-pod --container app-container
C.kubectl logs app-container -p web-pod
D.kubectl logs -c web-pod app-container
AnswerB

The kubectl logs command uses the --container (or shorthand -c) flag to select a specific container in a multi-container pod. Here, web-pod is the pod name and app-container is the container name, which is the exact syntax required. This command correctly returns only the logs from app-container, making it the right choice.

Why this answer

The correct command is 'kubectl logs web-pod -c app-container'. The -c flag specifies the container name.

598
MCQeasy

Which of the following is a core component of the Gateway API?

A.VirtualService
B.GatewayClass
C.IngressController
D.ServiceEntry
AnswerB

GatewayClass is a core, cluster-scoped resource in the Kubernetes Gateway API that defines a template and set of common configurations for a class of Gateways. Similar to how IngressClass functions for Ingress resources, it links the declarative API to a specific controller implementation that manages the underlying data plane infrastructure.

Why this answer

The Gateway API is a Kubernetes SIG-Network project that defines a set of resources for configuring service networking. Its core components are GatewayClass, Gateway, and HTTPRoute (or TCPRoute, etc.). GatewayClass is analogous to IngressClass in the Ingress API, defining a class of gateways that a controller can implement, making it a foundational core component.

Exam trap

The trap here is that candidates confuse the Gateway API's core resources (GatewayClass, Gateway, HTTPRoute) with similar-sounding resources from service meshes like Istio (VirtualService, ServiceEntry) or the older Ingress API (IngressController), leading them to select a non-core component.

How to eliminate wrong answers

Option A is wrong because VirtualService is a custom resource defined by the Istio project for traffic routing within a service mesh, not a core component of the Kubernetes Gateway API. Option C is wrong because IngressController is a generic term for the software that implements the Ingress API (e.g., NGINX Ingress Controller), not a resource defined by the Gateway API. Option D is wrong because ServiceEntry is an Istio resource used to register external services into the mesh, unrelated to the Gateway API's core resources.

599
MCQmedium

A cluster administrator wants to provide storage for an application that requires reading and writing by multiple pods simultaneously. The storage backend is an NFS server that supports multiple writers. Which access mode should be specified in the PersistentVolume?

A.ReadOnlyMany
B.ReadWriteOnce
C.ReadWriteOncePod
D.ReadWriteMany
AnswerD

ReadWriteMany (RWX) is the correct access mode because it allows multiple pods to mount the volume simultaneously with both read and write access, regardless of which nodes those pods run on. This is the only standard access mode that satisfies the requirement of shared read-write storage for many pods. RWX is typically supported by network-based storage like NFS, CephFS, or GlusterFS, and is essential for applications such as clustered web servers or shared content management systems.

Why this answer

The correct access mode is ReadWriteMany (RWX) because the application requires multiple pods to read and write simultaneously, and the NFS server supports multiple writers. RWX allows the PersistentVolume to be mounted as read-write by many nodes, which is the only access mode that satisfies the requirement for concurrent read-write access from multiple pods.

Exam trap

The trap here is that candidates often confuse ReadWriteOnce (RWO) with the ability to support multiple pods, forgetting that RWO restricts access to a single node, not just a single pod, and that ReadWriteMany (RWX) is required for multi-pod write access across nodes.

How to eliminate wrong answers

Option A is wrong because ReadOnlyMany (ROX) allows multiple pods to mount the volume, but only in read-only mode, which does not satisfy the write requirement. Option B is wrong because ReadWriteOnce (RWO) allows only a single node to mount the volume as read-write, preventing multiple pods on different nodes from writing simultaneously. Option C is wrong because ReadWriteOncePod (RWOP) restricts the volume to a single pod on a single node, which explicitly prevents multiple pods from accessing it concurrently.

600
MCQeasy

Which component is responsible for running containers on a Kubernetes node?

A.kube-proxy
B.kube-scheduler
C.kubelet
D.kube-controller-manager
AnswerC

The kubelet is the core node agent that takes PodSpecs from the API server or local manifests and uses the Container Runtime Interface to instruct a runtime such as containerd or CRI-O to pull images, create sandboxes, and start containers. It also monitors container health, enforces pod resources, and reports status back to the control plane. Because it is the component that directly drives the runtime, the kubelet is responsible for running containers.

Why this answer

The kubelet is the primary node agent that runs on each Kubernetes node. It is responsible for ensuring that containers are running in a Pod as expected by interacting with the container runtime (e.g., Docker, containerd, CRI-O) via the Container Runtime Interface (CRI). It receives Pod specifications from the API server and manages the lifecycle of the containers accordingly.

Exam trap

The trap here is that candidates often confuse the kubelet with the kube-scheduler or kube-controller-manager, thinking that scheduling or managing controllers is equivalent to running containers, but the kubelet is the only component that directly interacts with the container runtime to execute containers on a node.

How to eliminate wrong answers

Option A is wrong because kube-proxy is a network proxy that runs on each node, handling network rules and forwarding traffic to Pods (e.g., via iptables or IPVS), not running containers. Option B is wrong because kube-scheduler is a control plane component that assigns Pods to nodes based on resource availability and constraints, but it does not execute or manage containers on any node. Option D is wrong because kube-controller-manager runs controller processes (e.g., Node Controller, Replication Controller) that regulate cluster state, but it does not directly run containers on nodes.

Page 7

Page 8 of 10

Page 9

All pages