CKA Troubleshooting Practice Question
A pod is in CrashLoopBackOff. You run 'kubectl logs mypod --previous' and see 'Error: unable to connect to database'. What is the MOST likely cause?
⚠ Common exam trap
Test-takers frequently confuse application-level errors with probe failures, but the CKA exam expects you to recognize that a specific database connection error points to a network or service endpoint issue, not a probe misconfiguration or resource problem.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The database service endpoint is unreachable
The error 'unable to connect to database' indicates a network connectivity issue between the pod and the database service. Since the error is from the application itself (not a Kubernetes probe), the most likely cause is that the database service endpoint is unreachable, either due to a misconfigured service, incorrect DNS resolution, or network policy blocking traffic. The `--previous` flag shows logs from the previous container instance, confirming the application consistently fails to reach the database.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The database service endpoint is unreachable
Why this is correct
`kubectl logs` captures the container's stdout/stderr, so a database connection failure (e.g., "connection refused" or "dial tcp: lookup db-service") is exactly what appears. This is a typical application-level startup error that causes the process to exit, triggering the kubelet's restart backoff. Probe failures or OOM would not produce this specific log content, making this the most plausible direct cause.
- ✗
The pod's readiness probe is failing
Why it's wrong here
A failing readiness probe does not terminate the container; it only pauses traffic routing to the pod via the Service. The pod remains Running and the container continues to execute, so logs would show the application running normally, not a crash loop. CrashLoopBackOff is caused by the container exiting, which readiness probes cannot do.
- ✗
The pod's liveness probe is misconfigured
Why it's wrong here
A misconfigured liveness probe might cause the kubelet to restart the container if the probe endpoint is unreachable, but the logs would typically be silent about the probe itself—the container would run until killed by the kubelet. Also, if the container is crash-looping from a DB error, the liveness probe may never even be checked because the container exits before the probe completes. Misconfiguration would not explain a database connection error in the logs.
- ✗
The pod is out of memory
Why it's wrong here
An OOM kill is enforced by the kernel and does not appear in `kubectl logs`; the container's stdout/stderr ends abruptly without an application-level error message. You would see the container status as `OOMKilled` in `kubectl describe pod`, not a DB connection failure in the logs. Also, OOM would cause immediate termination, but the logs would show the last lines of output before the kill, not a specific connection error.
Visual reference
Go deeper
Related to this question
Learn chapter
Network Policies and Secure Connectivity
Key term
Network Policies
A Kubernetes resource that controls how pods communicate with each other and with other network endpoints, acting as a firewall for pod-to-pod traffic.
Key term
Log Analysis
Log analysis is the process of reviewing and interpreting system-generated records to understand what happened in an application or infrastructure.
About these practice questions
One of 726 original CKA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.