Courseiva

CCNA Troubleshooting Questions

57 of 207 questions · Page 3/3 · Troubleshooting · Answers revealed

151
MCQmedium

A node in your cluster shows status 'NotReady'. You have SSH access to the node. What is the first command you should run to check the kubelet status?

A.systemctl status docker (or containerd)
B.cat /var/log/kubelet.log
C.systemctl status kubelet
D.journalctl -u kubelet
AnswerC

The kubelet is the primary node agent that communicates with the Kubernetes control plane to report node status and heartbeat. Running systemctl status kubelet immediately reveals whether the service is active, inactive, or failing, which is the most direct and efficient first step when troubleshooting a NotReady node via SSH.

Why this answer

When a node is NotReady, the first step is to check if the kubelet service is running, because the kubelet is the primary agent responsible for reporting node status to the control plane. Running `systemctl status kubelet` immediately shows whether the kubelet service is active, failed, or stopped, along with recent log snippets, making it the fastest diagnostic command.

Exam trap

The trap here is that candidates often jump to checking logs (option B or D) first, but the CKA exam expects you to follow a systematic troubleshooting hierarchy: start with service status, then logs, then runtime checks.

How to eliminate wrong answers

Option A is wrong because checking the container runtime (docker or containerd) is a secondary step; the node status is reported by the kubelet, not the runtime, and a runtime failure would manifest as pod issues, not necessarily a NotReady node. Option B is wrong because reading the full kubelet log file is a deeper investigation step after confirming the service status; it is not the first command and can be time-consuming. Option D is wrong because `journalctl -u kubelet` provides detailed logs but is more verbose and slower than `systemctl status kubelet` for an initial health check; the first command should be the service status command to quickly see if the kubelet is running or failed.

152
MCQhard

You are troubleshooting a service named 'api' in the 'prod' namespace that is not reachable from other pods. You run 'kubectl get endpoints api -n prod' and see that the endpoints list is empty. The service selector is 'app=api', and there are three pods with that label running. Which of the following is the MOST likely cause?

A.The pods are not passing their readiness probes, so they are excluded from the service endpoints.
B.The service's targetPort does not match the containerPort, causing the endpoints controller to ignore the pods.
C.The pods are not in the same namespace as the service.
D.The service is of type ExternalName, which does not use selectors or endpoints.
AnswerA

Kubernetes only includes pods in a service's endpoints if they are in the Ready state. If the readiness probe fails, the pod is not considered ready, and its IP is not added to the endpoints. Even if the pods are running and have the correct label, they will not receive traffic. Checking the pod status with 'kubectl get pods -n prod -l app=api' and describing them to see readiness probe failures is the next step.

Why this answer

A service's endpoints are populated only with the IP addresses of pods that match the selector and are in the Ready state. If the readiness probe fails, the pod is not considered ready, and the endpoint is not created. This is a common cause of empty endpoints.

Checking pod readiness and probe configurations is essential. Other factors like namespace mismatch or port issues would not typically result in an empty endpoints list when pods are running.

Exam trap

The trap here is focusing on port mismatches or selector typos, when the most frequent cause of empty endpoints for a service with matching pods is failing readiness probes.

153
MCQeasy

You have a pod named 'web-pod' that is in a CrashLoopBackOff state. To examine the logs from the previous instance of the container, which command should you use?

A.kubectl logs web-pod --previous
B.kubectl exec web-pod -- cat /var/log/app.log
C.kubectl describe pod web-pod
D.kubectl logs web-pod
AnswerA

kubectl logs web-pod --previous fetches the log stream from the last terminated container instance, which is exactly where the application's crash output is preserved. The --previous flag reads the container's previous log file that survives restarts, allowing you to see the exception, error, or stack trace that triggered the CrashLoopBackOff rather than an empty or fresh current log.

Why this answer

The correct command is kubectl logs web-pod --previous (Option A). This retrieves the logs from the previous instance of the container, which is essential when a pod is in CrashLoopBackOff because the container has restarted and the current logs may be empty or not show the error from the previous run. Option B uses kubectl exec to read a log file, but it does not access previous logs and requires the container to be running.

Option C shows pod details but not logs. Option D shows current logs only, which may not capture the crash reason.

154
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.

155
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.

156
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.

157
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.

158
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.

159
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.

160
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.

161
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.

162
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.

163
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.

164
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.

165
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.

166
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.

167
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.

168
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.

169
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.

170
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.

171
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.

172
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.

173
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.

174
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.

175
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.

176
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.

177
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.

178
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.

179
MCQeasy

You want to view the resource usage of all pods in the cluster. What command should you run?

A.kubectl top pods --all-namespaces
B.kubectl describe nodes
C.kubectl get pods -o wide
D.kubectl top nodes
AnswerA

kubectl top pods --all-namespaces is the correct command because it retrieves current CPU and memory utilization for every pod running in every namespace. It sources these figures from the metrics API (backed by metrics-server) and displays them per pod along with the pod's namespace and node. Because the question asks for resource usage of all pods cluster-wide, this command is the only one that directly provides that data without omitting any namespace.

Why this answer

The `kubectl top pods --all-namespaces` command retrieves real-time CPU and memory usage metrics for all pods across every namespace in the cluster. This is the correct way to view resource usage of all pods, as it relies on the metrics server to collect and expose pod-level resource consumption data.

Exam trap

CNCF often tests the distinction between `kubectl top pods` and `kubectl top nodes`, where candidates mistakenly choose `kubectl top nodes` thinking it covers all pods, but it only shows node-level aggregates, not per-pod usage.

How to eliminate wrong answers

Option B is wrong because `kubectl describe nodes` shows node-level resource capacity, requests, and limits, but does not display actual real-time resource usage of individual pods. Option C is wrong because `kubectl get pods -o wide` only lists pod metadata and IP addresses, not resource usage metrics. Option D is wrong because `kubectl top nodes` shows aggregate node-level CPU and memory usage, not per-pod resource usage.

180
MCQmedium

You are troubleshooting DNS resolution from within a pod. You exec into the pod and run 'nslookup kubernetes.default.svc.cluster.local'. The command fails with 'connection timed out; no servers could be reached'. However, 'kubectl get svc -n kube-system' shows the kube-dns service with a ClusterIP. What is the MOST likely cause?

A.The CoreDNS pods are not running or are crashing
B.The pod's /etc/resolv.conf has incorrect search domains
C.A network policy is blocking traffic to the kube-dns service
D.The DNS name does not exist
AnswerA

This is the correct answer because if the CoreDNS pods are not running or are crashing, the Kubernetes `kube-dns` service will have no healthy endpoints. The `kube-proxy` component, responsible for managing service IPs, will be unable to forward DNS queries from pods to any functional CoreDNS instance. Consequently, any DNS lookup attempt from a pod will result in a connection timeout as the query never reaches an active DNS server to be processed.

Why this answer

The error 'connection timed out; no servers could be reached' from nslookup indicates that the pod cannot reach any DNS server at all. Since the kube-dns service exists (as shown by kubectl), the most likely cause is that the backend CoreDNS pods are not running or are crashing, so there are no endpoints to forward traffic to. Without running CoreDNS pods, the service's ClusterIP has no backing pods, causing all DNS queries to time out.

Exam trap

The trap here is that candidates see the kube-dns service exists and assume DNS is working, but they forget that a service without healthy backend pods (CoreDNS) cannot serve requests, leading to timeouts rather than immediate failures.

How to eliminate wrong answers

Option B is wrong because incorrect search domains in /etc/resolv.conf would cause name resolution failures for short names (e.g., 'kubernetes'), but the fully qualified domain name 'kubernetes.default.svc.cluster.local' would still resolve if the DNS server were reachable; the error here is a connection timeout, not a lookup failure. Option C is wrong because a network policy blocking traffic to the kube-dns service would typically result in a connection refused or timeout, but the question states the service exists and the error is a timeout; however, the most likely cause is the CoreDNS pods not running, as network policies are less common in default clusters and would not prevent the service from having endpoints. Option D is wrong because the DNS name 'kubernetes.default.svc.cluster.local' is a standard Kubernetes service name that exists by default; if it did not exist, nslookup would return 'NXDOMAIN' (non-existent domain), not a connection timeout.

181
MCQeasy

Which command shows the logs of a pod that has crashed and restarted?

A.kubectl logs pod-name --previous
B.kubectl logs pod-name
C.kubectl logs pod-name -c container-name
D.kubectl describe pod pod-name
AnswerA

The --previous flag retrieves log output from the previous terminated container instance. After a pod crashes and the container restarts, the newly started container starts with a fresh log file, so only --previous exposes the output from the failed run that triggered the restart. This is the standard way to diagnose why a container exited.

Why this answer

kubectl logs --previous shows logs from the previous container instance.

182
MCQeasy

Which command shows resource usage (CPU/memory) of all pods in the default namespace?

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

kubectl top pods is the direct client for the metrics.k8s.io API, which is normally served by metrics-server after it scrapes each node's Summary API from kubelet/cAdvisor. The command shows per-pod CPU usage in cores or millicores and memory usage in MiB, making it the standard way to view live resource consumption from the command line. This is precisely the resource-usage view the user is asking for.

Why this answer

kubectl top pod shows CPU and memory metrics for pods.

183
MCQmedium

A node in your cluster is marked as NotReady. You SSH into the node and run 'systemctl status kubelet'. The output shows the kubelet is inactive (dead). What should you do FIRST to restore the node?

A.Reboot the node
B.Delete the node object from the cluster
C.Run 'systemctl start kubelet'
D.Reinstall the kubelet package
AnswerC

Running 'systemctl start kubelet' is the correct first recovery action because Node NotReady status almost universally means the kubelet is not actively running or has failed to report its status. Starting the kubelet makes it contact the API server, renew its heartbeat, and re-register the node with its capacity and conditions, which allows the control plane to mark it Ready again. Before starting, you should verify the service status and check logs with 'journalctl -u kubelet', but the start command is the minimal and precise fix for a stopped kubelet daemon.

Why this answer

The kubelet service is stopped. The first step is to start it with 'systemctl start kubelet'. If it fails to start, further investigation with journalctl is needed.

184
MCQeasy

Which command lists all events in the cluster sorted by timestamp?

A.kubectl get events --watch
B.kubectl logs --events
C.kubectl describe events
D.kubectl get events --sort-by=.metadata.creationTimestamp
AnswerD

This is the correct command because `kubectl get` supports the `--sort-by` flag, which takes a JSONPath expression evaluated against each returned object. Here `.metadata.creationTimestamp` is the standard field that records when each event object was created, and the client sorts all events by that timestamp before printing them, giving chronological order. Combining the `events` resource with this sort key is the direct, supported way to list all events sorted by time.

Why this answer

'kubectl get events --sort-by=.metadata.creationTimestamp' shows events sorted by creation time. Alternatively, 'kubectl get events -w' watches events but does not sort.

185
MCQmedium

You run 'kubectl get nodes' and one node shows 'NotReady'. Which command should you run first to check the kubelet status on that node?

A.journalctl -u kubelet
B.kubectl describe node <node-name>
C.cat /var/log/syslog | grep kubelet
D.systemctl status kube-apiserver
AnswerA

journalctl -u kubelet reads the systemd journal for the kubelet service, the daemon that registers the node and reports its status to the control plane. When a node is NotReady, kubelet logs will contain the underlying error, such as a failed heartbeat to the API server, CNI interface issues, or a misconfigured kubeconfig. This is the authoritative source because kubelet runs as a systemd unit and its stderr/stdout are captured in the journal.

Why this answer

The kubelet is responsible for node status. On the node, you can check its logs with journalctl.

186
MCQhard

A pod is not able to communicate with another pod in the same namespace. Both pods are running and have IP addresses. Which command can you use to test connectivity from the first pod to the second pod's IP?

A.kubectl exec first-pod -- ping <second-pod-ip>
B.kubectl logs first-pod
C.kubectl top pod first-pod
D.kubectl exec second-pod -- ping <first-pod-ip>
AnswerA

kubectl exec first-pod -- ping <second-pod-ip> is the correct diagnostic because it enters the network namespace of the first pod and sends ICMP echo requests directly to the second pod's IP address. This actively tests layer 3 connectivity along the exact path the failing application would use, rather than relying on any proxy, load balancer, or DNS resolution. A successful reply confirms the network route and firewall rules permit traffic, while a failure localizes the problem to the pod-to-pod networking layer.

Why this answer

`kubectl exec first-pod -- ping <second-pod-ip>` runs the `ping` command inside the first pod, which uses ICMP to test IP-level connectivity to the second pod's IP address. This directly verifies whether the network path between the two pods is functional, including any CNI plugin, overlay network, or network policy rules.

Exam trap

The trap here is that candidates might choose Option D, thinking any ping between pods is equivalent, but the question specifically asks to test connectivity from the first pod to the second pod's IP, not the reverse direction.

How to eliminate wrong answers

Option B is wrong because `kubectl logs first-pod` only retrieves the container logs from the first pod, which does not test network connectivity to another pod. Option C is wrong because `kubectl top pod first-pod` shows resource usage (CPU/memory) of the first pod, not network connectivity. Option D is wrong because it runs `ping` from the second pod to the first pod's IP, which tests the reverse direction and does not diagnose connectivity from the first pod to the second pod as the question requires.

187
MCQmedium

You run 'kubectl get pods' and see a pod in 'CrashLoopBackOff'. You want to see the logs of the last crashed instance. Which command should you run?

A.kubectl logs pod-name --previous
B.kubectl logs pod-name --all-containers
C.kubectl logs pod-name --last
D.kubectl logs pod-name
AnswerA

The --previous flag instructs kubectl to fetch logs from the container's prior terminated instance rather than the current one. In CrashLoopBackOff the running container has just restarted, so only the previous instance holds the crash output needed for diagnosis.

Why this answer

The `--previous` flag (or its shorthand `-p`) tells `kubectl logs` to retrieve logs from the previous instance of a container that has crashed and restarted. Since the pod is in `CrashLoopBackOff`, the current container has already exited, and you need to inspect the logs of the last terminated container to diagnose the crash. To avoid having two correct answers, Option C has been changed to an invalid flag.

Exam trap

The trap here is that candidates often think `kubectl logs pod-name` alone will show crash logs, but it only shows logs from the currently running container (which may be empty or not yet started), and they overlook the `--previous` flag that is specifically designed for accessing logs of a terminated container.

How to eliminate wrong answers

Option B is wrong because `--all-containers` streams logs from all containers in the pod simultaneously, but it does not retrieve logs from a previous (crashed) instance; it only shows current container logs. Option C is wrong because `-p` is the shorthand for `--previous`, so this option is actually correct and identical to A; however, the question expects the explicit `--previous` flag as the answer, and `-p` is not listed as a separate correct choice. Option D is wrong because `kubectl logs pod-name` without any flag only shows logs from the currently running container; in a `CrashLoopBackOff` state, the current container may have just started and has no useful logs, or the command may fail if no container is currently running.

188
MCQmedium

You run 'kubectl get pods' and see a pod in 'ImagePullBackOff' state. Which of the following is NOT a common cause?

A.The image tag does not exist
B.The image registry requires authentication
C.The image name is misspelled
D.The node has a taint that tolerates the pod
AnswerD

If a node has a taint and the pod has a matching toleration, the Kubernetes scheduler can successfully assign the pod to that node. This scheduling mechanism has no bearing on the container runtime's ability to pull images. If scheduling succeeds, the pod will not enter ImagePullBackOff unless there is an unrelated image retrieval issue.

Why this answer

NOT a common cause of ImagePullBackOff because taints and tolerations affect pod scheduling, not image pulling. ImagePullBackOff occurs when the kubelet fails to pull the container image from the registry, which is a runtime issue unrelated to node scheduling constraints.

Exam trap

The CKA exam often tests the distinction between scheduling issues (taints/tolerations) and runtime issues (image pulling), so candidates mistakenly associate any pod failure with taints when the pod is actually running but failing to pull its image.

How to eliminate wrong answers

Option A is wrong because a non-existent image tag (e.g., 'myapp:latest' when only 'myapp:v1' exists) causes the registry to return a manifest not found error, triggering ImagePullBackOff. Option B is wrong because missing or invalid registry credentials (e.g., for a private registry like Docker Hub or ECR) result in authentication failures, leading to ImagePullBackOff. Option C is wrong because a misspelled image name (e.g., 'ngnix' instead of 'nginx') causes the registry to return a 404 or name unknown error, which is a common cause of ImagePullBackOff.

189
MCQhard

You are troubleshooting a pod that is in 'CrashLoopBackOff' state. You run 'kubectl logs mypod' and get no output. You then run 'kubectl logs mypod --previous' and see an error: 'Error: failed to start container: context deadline exceeded'. What is the MOST likely cause?

A.The container image is missing the entrypoint
B.The application inside the container is crashing immediately
C.The container command is incorrectly specified
D.The container runtime is unable to start the container due to a timeout
AnswerD

The 'context deadline exceeded' error indicates that the kubelet's or CRI runtime's operation to create or start the container exceeded its deadline before completing successfully. This is typical when the container runtime hangs during image pull, storage setup, runc init, or other pre-start steps, and after repeated failures the kubelet marks the pod as CrashLoopBackOff. It is a runtime-level timeout rather than an application or command issue, so inspecting the container runtime service and underlying node resources is the appropriate debugging path.

Why this answer

The error 'failed to start container: context deadline exceeded' indicates the container runtime (containerd/CRI-O) could not start the container within the allotted timeout, typically due to image pull slowness, runtime hang, or resource pressure. Because kubectl logs with --previous shows this runtime-level error rather than an application stack trace, the root cause is the runtime failing to launch the container, not the app crashing.

Exam trap

CKA often tests the confusion between application-level crashes (which show app logs) and runtime-level start failures (which show CRI errors), leading candidates to blame the app when the container never actually started.

How to eliminate wrong answers

Option A is wrong because a missing entrypoint would produce an 'executable file not found' or 'no such file or directory' error, not a context deadline exceeded. Option B is wrong because an immediately crashing application would produce application logs (stack traces, exit codes) in --previous output, not a runtime start timeout. Option C is wrong because an incorrectly specified command would yield a command-not-found or exec format error, again not a deadline exceeded message.

190
MCQmedium

A pod is unable to resolve DNS names. You exec into the pod and run 'nslookup kubernetes.default.svc.cluster.local'. The command hangs. What is the MOST likely cause?

A.The CoreDNS service is not running or is misconfigured
B.The pod's /etc/resolv.conf is missing
C.The kubelet is not running on the node
D.The pod's network policy blocks DNS traffic
AnswerA

CoreDNS is the cluster's authoritative DNS service, and its Service IP is what kubelet writes into every pod's /etc/resolv.conf as the nameserver. If the CoreDNS Deployment has no available replicas, the Service has no endpoints, or the Corefile is misconfigured (e.g., invalid forward upstreams), queries will time out or return SERVFAIL. This directly explains why a running pod with a valid resolv.conf still cannot resolve any DNS names.

Why this answer

The CoreDNS service is responsible for DNS resolution within the cluster. If it is not running or misconfigured, DNS queries from pods will hang or fail. The `nslookup` command hanging indicates that the DNS request is not being answered, which is a classic symptom of a non-functional or unreachable DNS service.

Exam trap

The trap here is that candidates may assume a network policy is blocking traffic (option D) because it sounds plausible, but the most common and direct cause of a hanging DNS query in a Kubernetes cluster is a non-functional CoreDNS service, not a network policy.

How to eliminate wrong answers

Option B is wrong because a missing /etc/resolv.conf would cause an immediate 'no such file or directory' error, not a hang. Option C is wrong because if the kubelet were not running, the pod itself would not be running or accessible via exec. Option D is wrong because a network policy blocking DNS traffic would typically result in a timeout or connection refused, but the most common and direct cause of a hang in `nslookup` is the DNS service itself being down or misconfigured.

191
MCQmedium

You run 'kubectl get nodes' and see that a node is 'NotReady'. You SSH into the node and run 'systemctl status kubelet'. The output shows 'Active: inactive (dead)'. What is the most likely cause?

A.The network plugin is misconfigured
B.The node has been cordoned
C.The kubelet service is stopped
D.The container runtime is not installed
AnswerC

The kubelet is the primary agent responsible for registering the node with the Kubernetes API server and continuously reporting its health, resource utilization, and the status of pods running on it. If the kubelet service is stopped or inactive, it ceases to send heartbeats and status updates to the control plane. This complete lack of communication directly causes the API server to mark the node as `NotReady`, as it can no longer ascertain the node's operational state or manage its workloads.

Why this answer

The kubelet is the primary node agent that runs on every node and is responsible for maintaining pod lifecycles. When 'systemctl status kubelet' shows 'Active: inactive (dead)', it means the kubelet systemd service is not running. Since the kubelet must be active for the node to report its status to the control plane, a stopped kubelet directly causes the node to be 'NotReady'.

Exam trap

The trap here is that candidates often confuse a stopped kubelet with a kubelet that is running but unhealthy (e.g., due to container runtime issues), leading them to select option D, but the 'inactive (dead)' status specifically indicates the service is not running at all, not that it is failing to start.

How to eliminate wrong answers

Option A is wrong because a misconfigured network plugin (e.g., CNI) would cause pods to fail networking but the kubelet would still be running and the node would typically show 'Ready' with pod issues, not 'NotReady' due to a dead kubelet. Option B is wrong because cordoning a node (via 'kubectl cordon') marks it as 'SchedulingDisabled' but does not stop the kubelet; the node remains 'Ready' and the kubelet service stays active. Option D is wrong because if the container runtime (e.g., containerd or CRI-O) were not installed, the kubelet would fail to start or would crash-loop, but the service would show 'active (running)' or 'failed', not 'inactive (dead)'.

192
MCQeasy

Which command would you use to check the status of the kube-apiserver on a control plane node managed by systemd?

A.kubectl get apiservice
B.service kube-apiserver status
C.journalctl -u kubelet
D.systemctl status kube-apiserver
AnswerD

This is the standard systemd command used to query the active state, process ID, and recent log outputs of the kube-apiserver service when it is run as a system daemon. It directly queries the systemd init manager to verify if the process is running, active, or failing. This is crucial for troubleshooting control plane bootstrap issues on master nodes where components are managed as systemd services.

Why this answer

The kube-apiserver is a systemd service on control plane nodes managed by systemd. The `systemctl status kube-apiserver` command queries systemd for the current state, including active status, PID, memory usage, and recent log entries, which is the standard method for checking a systemd-managed service.

Exam trap

The trap here is that candidates confuse Kubernetes API resources (like `apiservice`) with the actual system process, or mistakenly use `kubectl` commands when the API server itself is unresponsive, making node-level systemd commands the only viable option.

How to eliminate wrong answers

Option A is wrong because `kubectl get apiservice` lists API service objects (like metrics-server) registered in the cluster, not the status of the kube-apiserver process itself. Option B is wrong because `service kube-apiserver status` uses the SysV init script interface, which may not be available or accurate on modern systemd-based distributions; systemd does not automatically create SysV compatibility for all services. Option C is wrong because `journalctl -u kubelet` shows logs for the kubelet service, not the kube-apiserver; the correct unit name for the API server is `kube-apiserver`.

193
MCQeasy

A node in your cluster is reporting a DiskPressure condition. Which kubectl command would you use to get details about the node's condition?

A.kubectl get nodes
B.kubectl describe node <node-name>
C.kubectl logs <node-name>
D.kubectl get events --field-selector involvedObject.kind=Node
AnswerB

`kubectl describe node <node-name>` is the correct first command because it displays the node's Conditions section, where the kubelet reports DiskPressure with a True/False status, the last heartbeat time, and a message explaining the eviction signal. It also aggregates related events, capacity, allocatable resources, and configured kubelet pressure thresholds. This directly and authoritatively reveals whether the node is under disk pressure and gives actionable diagnostic context.

Why this answer

The `kubectl describe node <node-name>` command provides detailed information about a node, including its status, capacity, allocatable resources, and a list of conditions (e.g., DiskPressure, MemoryPressure, PIDPressure, Ready). This is the standard way to inspect the exact reason and timestamps for a DiskPressure condition, as well as related metrics like disk usage and inode consumption.

Exam trap

CNCF often tests the distinction between high-level status commands (`kubectl get nodes`) and detailed diagnostic commands (`kubectl describe node`), trapping candidates who think a simple status list is sufficient to investigate a specific condition like DiskPressure.

Why the other options are wrong

A

This only lists nodes and high-level status, not detailed conditions.

C

Logs are for pods, not nodes.

D

Events may show node issues but the describe command is more comprehensive for conditions.

194
MCQhard

You have a Deployment with livenessProbe configured. The pod restarts every few minutes. 'kubectl describe pod' shows the liveness probe is failing with 'HTTP probe failed with statuscode: 503'. The application's /healthz endpoint returns 200 from within the pod using 'kubectl exec'. What could be the issue?

A.The readinessProbe is interfering with the livenessProbe
B.The application has a memory leak
C.The kubelet on the node is misconfigured
D.The livenessProbe is configured with the wrong port
AnswerD

The livenessProbe is explicitly configured to send an HTTP request to a specific containerPort, so if that port does not match the port the application is actually listening on, kubelet will receive a connection refused error (or non-2xx response). Kubernetes treats any non-2xx response or connection error as a probe failure; after the failureThreshold is reached, kubelet kills and restarts the container. This produces exactly the observed symptom: the container starts, becomes ready for a moment, then repeatedly restarts while the application itself is healthy on its real port.

Why this answer

The liveness probe is failing externally but the endpoint works internally. This suggests the probe is hitting the wrong port or the network path is different. The most likely cause is that the livenessProbe is configured with a wrong port number.

195
MCQeasy

Which command can you use to view the logs of a container that has crashed and been restarted?

A.kubectl describe pod pod-name
B.kubectl logs pod-name --previous
C.kubectl exec pod-name -- cat /var/log/crash.log
D.kubectl logs pod-name
AnswerB

The --previous flag tells kubectl to fetch logs from the last terminated instance of a container in the pod, which is exactly what you need when the current container has already crashed and restarted. Since a container that has exited no longer has accessible live logs, this flag retrieves the previously captured log output from the terminated container, allowing you to diagnose the cause of the crash. This is the standard approach for debugging CrashLoopBackOff or a one-time termination before the current container starts. Without the flag, you would only get logs from the current, possibly already-restarted container, missing the crash evidence.

Why this answer

The --previous flag retrieves logs from the previous instance of the container.

196
MCQhard

A node is NotReady. You ssh into the node and run 'systemctl status kubelet'. It shows 'Active: inactive (dead)'. What is the most appropriate next step?

A.journalctl -u kubelet
B.systemctl start kubelet
C.kubectl delete node <node-name>
D.systemctl restart docker
AnswerB

systemctl start kubelet directly addresses the most common cause of a NotReady node: the kubelet service being stopped or inactive. When started, the kubelet initializes, connects to the API server, and begins sending its Node status heartbeat, which the node controller uses to mark the node Ready once all conditions (such as memory, disk, and runtime) are satisfied. This is the immediate, targeted remediation for a node stuck in NotReady due to a down kubelet, and it is the correct first step after confirming the service is not running.

Why this answer

Starting the kubelet service with systemctl start kubelet is the correct action. Investigating logs may be needed if it fails to start.

197
MCQmedium

You run 'kubectl get nodes' and see that one node is in the 'NotReady' state. Which command would you use FIRST to investigate the kubelet status on that node?

A.ssh to the node and run 'docker ps'
B.kubectl describe node <node-name>
C.kubectl logs kubelet -n kube-system
D.systemctl status kubelet
AnswerD

The 'kubelet' runs as a 'systemd' service on each Kubernetes node, responsible for registering the node with the cluster and managing pods. To diagnose issues where a node is not ready, checking the 'kubelet' service status directly on the node using 'systemctl status kubelet' is the most effective first step. This command provides real-time information about whether the service is active, stopped, or failed, along with recent log entries that often pinpoint the root cause of any operational problems.

Why this answer

The kubelet is the primary node agent that registers the node with the cluster and reports its status via periodic heartbeats. When a node is NotReady, the first step is to check if the kubelet service is running on that node using `systemctl status kubelet` (or `journalctl -u kubelet`), because a stopped or unhealthy kubelet will directly cause the node to lose connectivity with the control plane. This command is the most direct way to verify the kubelet's process state and recent logs on the node itself.

Exam trap

The trap here is that candidates assume `kubectl describe node` is the first troubleshooting step for a NotReady node, but it only shows the symptom from the control plane's view, not the root cause on the node, which requires direct node access to check the kubelet service.

How to eliminate wrong answers

Option A is wrong because `docker ps` only lists running containers managed by Docker, not the kubelet service itself, and the kubelet may be running as a systemd unit or binary, not a container. Option B is wrong because `kubectl describe node` shows the node's status and conditions from the control plane's perspective, but if the kubelet is down, the API server may have stale data and cannot reveal the actual kubelet process state on the node. Option C is wrong because `kubectl logs kubelet -n kube-system` assumes the kubelet runs as a pod in the cluster, which is not the case—kubelet is a system-level daemon managed by systemd, not a Kubernetes workload, so its logs are accessed via `journalctl` or `systemctl`, not `kubectl logs`.

198
MCQeasy

You have a pod that is in 'Pending' state. Which command would you use to view detailed information about the pod's status, including events that may indicate why it is not running?

A.kubectl get endpoints
B.kubectl logs pod
C.kubectl describe pod
D.kubectl get pod
AnswerC

This is the correct command because it queries the Kubernetes API server for the detailed state, conditions, and event history of the specified Pod. The "Events" section at the bottom of the output will explicitly reveal why the Pod is pending, such as insufficient CPU/memory on nodes, taints and tolerations mismatches, or unbound PersistentVolumeClaims.

Why this answer

C is correct because `kubectl describe pod` provides detailed information about the pod's current state, including status conditions, container statuses, and a chronological list of events associated with the pod. These events often contain error messages (e.g., 'FailedScheduling', 'ImagePullBackOff', 'CrashLoopBackOff') that directly explain why the pod is stuck in 'Pending' state, such as insufficient resources or persistent volume claim issues.

Exam trap

The trap here is that candidates often assume `kubectl logs` can show startup errors even when the pod has never run, or they confuse `kubectl get` with `kubectl describe`, not realizing that `get` only shows a high-level status without the event history needed for troubleshooting.

How to eliminate wrong answers

Option A is wrong because `kubectl get endpoints` displays network endpoints for services, not pod-level status or events; it is irrelevant to diagnosing a pod stuck in 'Pending'. Option B is wrong because `kubectl logs pod` retrieves container logs from a running or previously running container, but a pod in 'Pending' state has not started any containers, so there are no logs to fetch. Option D is wrong because `kubectl get pod` only shows a summary of the pod's phase (e.g., 'Pending') and basic fields like name and age, without the detailed events or conditions needed to identify the root cause.

199
MCQhard

You are a CKA managing a production cluster with 5 worker nodes. A developer reports that a new deployment 'payment-service' is not accessible from other pods via its Service 'payment-svc' in the 'default' namespace. The Service is of type ClusterIP with selector 'app: payment'. The deployment has 3 replicas, all showing 'Running' status. From a test pod, you run 'curl http://payment-svc:8080' and get 'Connection refused'. You verify that the pods are listening on port 8080 and the container's readiness probe passes. 'kubectl get endpoints payment-svc' shows no endpoints. 'kubectl describe svc payment-svc' shows the selector 'app=payment'. What is the most likely cause?

A.A NetworkPolicy is blocking traffic from the test pod to the service IP.
B.The service type should be NodePort to allow in-cluster access.
C.The readiness probe is failing on all pods, causing them to be removed from service endpoints.
D.The pods have label 'app: payment-service' instead of 'app: payment', so the service selector does not match.
AnswerD

A Service's spec.selector uses exact key-value matching to choose backing pods. If the selector is app: payment and the pods are labeled app: payment-service, the values are different, so the Endpoints controller does not add any pod IP to the Service's backend. Label matching is exact, not substring-based, so the Service will have no endpoints and in-cluster clients cannot connect to it.

Why this answer

The most likely cause is that the pods' labels do not match the Service's selector. The Service 'payment-svc' uses selector 'app: payment', but the pods have label 'app: payment-service'. Since the selector does not match any pods, the Service's endpoints list is empty, causing 'Connection refused' when trying to reach the ClusterIP.

The pods are running and listening on port 8080, but the Service has no backends to forward traffic to.

Exam trap

The trap here is that candidates often assume a NetworkPolicy or readiness probe issue when they see 'Connection refused', but the empty endpoints list directly points to a selector mismatch, which is a fundamental Kubernetes networking concept tested in the CKA.

How to eliminate wrong answers

Option A is wrong because a NetworkPolicy can block traffic to pods or from specific sources, but it does not affect the Service's endpoint list; the endpoints would still be populated if the selector matched. Option B is wrong because ClusterIP is the correct type for in-cluster access; NodePort is used for external access and does not change internal connectivity. Option C is wrong because the readiness probe passes on all pods, as stated in the scenario, so pods would not be removed from endpoints; if the probe were failing, the pods would be removed, but the scenario explicitly says the readiness probe passes.

200
Multi-Selectmedium

You run 'kubectl get pods' and see that a pod named 'db' is in 'CrashLoopBackOff'. Which TWO commands are most useful for diagnosing the issue? (Choose two)

Select 2 answers
A.kubectl top pod db
B.kubectl describe pod db
C.kubectl logs db
D.kubectl get pod db -o yaml
E.kubectl exec db -- /bin/sh
AnswersB, C

This command retrieves detailed lifecycle information directly from the Kubernetes API server, including the pod's current state, container statuses, and historical events. Crucially, it displays the "Last State" field, which reveals the exit code and termination message of the previous failed container run. This makes it an essential first-line troubleshooting tool for identifying configuration or startup failures.

Why this answer

Option B, 'kubectl describe pod db', is correct because it surfaces the pod's Events section, which shows scheduling failures, image pull errors, container restarts, and the exit codes/reasons behind the CrashLoopBackOff. Option C, 'kubectl logs db', is correct because it retrieves the container's stdout/stderr, revealing the application-level error or stack trace that caused the process to exit and restart repeatedly. Together these two commands cover both the kubelet-side view (describe) and the application-side view (logs) of why the container keeps crashing.

Option A, 'kubectl top pod db', only reports CPU/memory usage and cannot explain a crash loop, and it often fails anyway if the container isn't running. Option D, 'kubectl get pod db -o yaml', shows the pod spec and status but not the event history or application output needed to diagnose the crash. Option E, 'kubectl exec db -- /bin/sh', is not useful because the container is not staying up long enough to exec into, and it doesn't reveal the prior crash cause.

Exam trap

The trap here is that candidates often choose 'kubectl get pod -o yaml' thinking it shows runtime errors, but it only shows the desired and current state in YAML format, not the event history or container logs that are essential for diagnosing a CrashLoopBackOff.

201
MCQmedium

A Node is reporting DiskPressure condition. Which action is most appropriate to resolve this without losing data?

A.kubectl delete node <node-name>
B.Add additional disk space to the node or clean up unused images and logs
C.kubectl drain <node-name> --ignore-daemonsets
D.Restart the kubelet service
AnswerB

The kubelet continuously monitors filesystem usage against eviction thresholds, and DiskPressure is cleared only when usage falls below the configured soft-eviction threshold. Adding physical storage increases available capacity, while cleaning up unused container images, stopped container writable layers, and journal/application logs directly reclaims space. After space is freed, kubelet automatically updates the condition and scheduling on the node resumes.

Why this answer

DiskPressure indicates that the node's disk usage has exceeded the eviction threshold (default 85% for imagefs.available and nodefs.available). Adding disk space or cleaning up unused container images (via `crictl rmi` or `docker image prune`) and logs (via log rotation or `journalctl --vacuum`) directly frees up space without affecting running workloads or causing data loss, addressing the root cause.

Exam trap

The trap here is that candidates confuse DiskPressure with node unavailability and choose `kubectl drain` (Option C) to evacuate pods, not realizing that draining does not resolve the disk space issue and can cause data loss for stateful workloads.

Why the other options are wrong

A

Deleting the node removes it from cluster; does not fix disk pressure.

C

Drain evicts pods but does not free disk space; disk pressure persists.

D

Restarting kubelet does not free disk space; pressure will remain.

202
MCQmedium

You have a Deployment with 3 replicas. One of the pods is in 'Pending' state. 'kubectl describe pod' shows: 'Warning FailedScheduling 0/4 nodes are available: 1 node(s) had taint {key1: value1}, that the pod didn't tolerate, 3 node(s) didn't match pod anti-affinity rules.' Which two issues are preventing the pod from being scheduled?

A.Taint toleration mismatch and pod anti-affinity conflicts
B.Pod anti-affinity and node selector issues
C.Node selector and taint toleration mismatch
D.Resource constraints and taint toleration mismatch
AnswerA

The event log explicitly reports a taint toleration mismatch, meaning the node carries taints the pod does not tolerate, and simultaneously reports a pod anti-affinity conflict, meaning the pod's scheduling constraints prevent it from co-locating with pods that match its anti-affinity selector. Both of these conditions together are present in the pod's unschedulable event. This answer correctly identifies the two distinct scheduling constraints that block the pod, so it is the right choice.

Why this answer

The error message explicitly states two distinct scheduling failures: '1 node(s) had taint {key1: value1}, that the pod didn't tolerate' and '3 node(s) didn't match pod anti-affinity rules.' These correspond directly to a taint toleration mismatch and pod anti-affinity conflicts. No other issues (node selector, resource constraints) are mentioned in the describe output.

Exam trap

The CKA exam often tests the ability to read the exact error message from `kubectl describe pod` and map each clause to a specific scheduling issue, rather than assuming generic problems like resource limits or node selectors.

How to eliminate wrong answers

Option B is wrong because the error message does not mention 'node selector' — it only references taint toleration and anti-affinity rules, so a node selector issue is not present. Option C is wrong because it includes 'node selector' which is not indicated in the error, and while taint toleration mismatch is correct, the second issue is anti-affinity, not node selector. Option D is wrong because 'resource constraints' (e.g., CPU/memory insufficient) would appear as 'Insufficient cpu' or 'Insufficient memory' in the describe output, not as a taint or anti-affinity message.

203
MCQmedium

A pod named 'web' in the 'default' namespace is in Running state, but users report that the application is not responding. You run 'kubectl exec web -- curl -v http://localhost:8080' and see 'Connection refused'. The pod's container is listening on port 8080. Which of the following is the MOST likely cause?

A.The pod's readiness probe is failing, causing the endpoint to be removed from the service.
B.The application inside the container is not actually listening on port 8080, or it is bound to a different interface.
C.A NetworkPolicy is blocking traffic from localhost to port 8080.
D.The container's network namespace is not properly configured, so localhost does not resolve.
AnswerB

Connection refused means the TCP connection attempt was actively rejected, which typically happens when no process is listening on the specified port. It could be that the application is listening on a different port, or it is bound only to 127.0.0.1 inside the container, but 'localhost' should resolve to 127.0.0.1, so binding to 127.0.0.1 would still be reachable. However, if the application is listening on a different port or not at all, you get connection refused. Checking the application logs and the actual listening ports inside the container is necessary.

Why this answer

A connection refused error when curling localhost inside a pod indicates that no process is listening on the target port. The application may have crashed, be configured to listen on a different port, or not be started at all. Checking the container logs and running 'netstat -tuln' or 'ss -tuln' inside the container will reveal the actual listening ports.

This is a common troubleshooting step to verify application configuration.

Exam trap

The trap here is assuming that a Running pod means the application is healthy and listening on the expected port, when in fact the process may have failed or be misconfigured.

204
Multi-Selecteasy

You are troubleshooting a node that shows 'NotReady' status. Which TWO commands can help you investigate the kubelet state?

Select 2 answers
A.kubectl get nodes
B.journalctl -u docker
C.journalctl -u kubelet
D.systemctl status kubelet
E.kubectl describe pod
AnswersC, D

journalctl -u kubelet is the correct first place to look because the kubelet is the component that actually reports NodeReady status to the API server and runs the node's static pods and system components. Kubelet logs will show concrete errors such as failed to GET /healthz, admission rejections, CNI plugin failures, or inability to connect to the API server, making this the most direct source of truth for diagnosing a NotReady node.

Why this answer

journalctl -u kubelet (C) retrieves kubelet logs from the systemd journal, showing errors and warnings. systemctl status kubelet (D) displays the current status of the kubelet service, including whether it is running, enabled, and recent log entries. The other options: 'kubectl get nodes' (A) shows node status but not kubelet details; 'journalctl -u docker' (B) shows container runtime logs, not kubelet; 'kubectl describe pod' (E) is for pod details, not node-level kubelet troubleshooting.

205
MCQmedium

You are debugging a DNS issue in the cluster. Which of the following tools is commonly used to test DNS resolution from within a Pod?

A.ping
B.tcpdump
C.curl
D.nslookup
AnswerD

nslookup is a dedicated network administration tool specifically designed to query Domain Name System servers to obtain mapping or domain name resource records. In a Kubernetes environment, it allows administrators to directly query the CoreDNS service IP for specific internal records, such as Service A-records or Headless Service SRV records. This direct querying capability makes it the standard utility for isolating and verifying DNS resolution issues within a cluster.

Why this answer

`nslookup` is a dedicated DNS lookup utility that queries DNS servers directly, making it the standard tool for testing DNS resolution from within a Pod. It sends DNS queries to the cluster's DNS service (e.g., CoreDNS or kube-dns) and returns the resolved IP addresses, allowing you to verify that DNS records for Services, Pods, or external hosts are correctly configured and reachable.

Exam trap

The trap here is that candidates often confuse network connectivity tools (like `ping` or `curl`) with DNS-specific tools, assuming that if a hostname is reachable via `ping`, DNS is working, but `ping` can succeed via other mechanisms (e.g., local hosts file or cached entries) and does not validate DNS resolution.

How to eliminate wrong answers

Option A is wrong because `ping` tests network connectivity using ICMP echo requests, not DNS resolution; it cannot query DNS records or verify that a hostname resolves correctly. Option B is wrong because `tcpdump` is a packet capture tool that analyzes network traffic at the packet level, not a DNS resolution tool; it requires deep packet inspection and is not designed for simple DNS lookups. Option C is wrong because `curl` is used to transfer data with URLs (e.g., HTTP/HTTPS), and while it may trigger DNS resolution internally, it does not provide direct DNS query results and can fail for reasons unrelated to DNS (e.g., HTTP errors or firewall rules).

206
MCQmedium

You deploy a pod with the following YAML: apiVersion: v1 kind: Pod metadata: name: test-pod spec: containers: - name: test image: nginx resources: requests: memory: "64Mi" cpu: "250m" limits: memory: "128Mi" cpu: "500m" The pod starts, but after a few minutes it is killed with OOMKilled. What is the MOST likely reason?

A.The memory limit is lower than the memory request
B.The node has swap enabled
C.The container's memory usage exceeds the configured limit
D.The container is using too much CPU
AnswerC

When a container's memory consumption, specifically its Resident Set Size (RSS), exceeds the `memory.limit_in_bytes` enforced by its cgroup, the Linux kernel's Out-Of-Memory (OOM) killer is invoked. This mechanism is designed to protect the host system from memory exhaustion by terminating processes that have surpassed their allocated memory resources. In this specific scenario, the container was terminated precisely because its application attempted to allocate or utilize memory beyond the 128Mi limit, triggering the OOM killer to reclaim system resources.

Why this answer

OOMKilled occurs when a container exceeds its memory limit. In this YAML, the memory limit is set to 128Mi. If the nginx container's memory usage surpasses 128Mi, the Linux kernel's Out-Of-Memory (OOM) killer terminates the container process, resulting in an OOMKilled status.

This is a direct enforcement of the resource limit configured in the pod spec.

Exam trap

Candidates often confuse CPU limits with memory limits. Exceeding CPU limits results in CPU throttling (the container is slowed down but not killed), whereas exceeding memory limits results in the container being terminated immediately with an OOMKilled (Exit Code 137) status. Additionally, note that the Kubernetes API server will reject any Pod creation attempt where requests are higher than limits, making Option A structurally impossible.

How to eliminate wrong answers

Option A is wrong because having a memory limit lower than the memory request is allowed; Kubernetes only requires that limits are not lower than requests for CPU, but for memory, it is permitted and does not cause OOMKilled. Option B is wrong because swap is typically disabled in Kubernetes nodes (kubelet default is --fail-swap-on=true), and even if enabled, OOMKilled is triggered by exceeding the memory limit, not by swap usage. Option D is wrong because OOMKilled is specifically a memory-related termination; excessive CPU usage leads to CPU throttling (via CFS quotas), not container termination with OOMKilled.

207
MCQmedium

You run 'kubectl get pods' and see a pod in 'CrashLoopBackOff'. What command would you run to see the reason for the crash?

A.kubectl top pod <pod-name>
B.kubectl describe pod <pod-name>
C.kubectl rollout status deployment <deployment-name>
D.kubectl get events --field-selector involvedObject.name=<pod-name>
AnswerB

kubectl describe pod surfaces the container's last terminated state, exit code and events, which reveal why the process exited and triggered the restart loop. Logs show application output but not the termination reason, so describe is the direct diagnostic for CrashLoopBackOff.

Why this answer

B is correct because `kubectl describe pod <pod-name>` provides detailed information about the pod, including the container state, restart count, and the last termination reason (e.g., 'Error' or 'OOMKilled') along with its exit code. To view the actual stdout/stderr logs of the crashed container, you would use `kubectl logs <pod-name> --previous`.

Exam trap

The CKA exam often tests your ability to troubleshoot failing pods. Candidates sometimes confuse `kubectl describe pod` (which shows metadata, events, and container exit codes/termination reasons) with `kubectl logs <pod-name> --previous` (which retrieves the actual application logs from the failed container). Both are critical troubleshooting steps, but `describe` is the primary tool for checking the high-level termination reason and exit code.

How to eliminate wrong answers

Option A is wrong because `kubectl top pod` shows real-time CPU and memory usage metrics, not crash reasons or container exit statuses. Option C is wrong because `kubectl rollout status deployment` checks the rollout progress of a deployment (e.g., whether new ReplicaSets are available), not the crash details of an individual pod. Option D is wrong because while `kubectl get events` can show pod-related events, the field selector `involvedObject.name=<pod-name>` filters events by the pod's name but may miss the container-level termination reason (which is stored in the pod's status, not always in events), and it does not provide the structured exit code and reason as `kubectl describe` does.

← PreviousPage 3 of 3 · 207 questions total

Ready to test yourself?

Try a timed practice session using only Troubleshooting questions.