CKA Troubleshooting Practice Question
You suspect a DNS issue within the cluster. Which TWO commands can you run from within a pod to test DNS resolution?
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
✓
dig kubernetes.default.svc.cluster.local
Options C and E are correct because both dig and nslookup are dedicated DNS query tools that directly resolve the name kubernetes.default.svc.cluster.local against the cluster DNS service (CoreDNS/kube-dns), letting you verify the returned A/AAAA records and diagnose resolution failures from inside the pod. dig queries the configured resolver and shows the ANSWER SECTION, while nslookup performs an equivalent name-resolution lookup, so either one specifically tests DNS rather than general connectivity. Option A (ping) is not a DNS test per se; it only triggers resolution as a side effect and may fail due to ICMP being blocked even when DNS works. Option B (kubectl exec -it pod-name -- /bin/sh) merely opens a shell in the pod and does not itself test DNS resolution. Option D (curl http://kubernetes.default.svc.cluster.local) tests HTTP connectivity to the API server, not DNS, and can fail for reasons unrelated to name resolution.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
ping kubernetes.default.svc.cluster.local
Why it's wrong here
ping sends ICMP Echo Request packets to an IP address, and while it does trigger a DNS lookup for the hostname, that lookup is incidental. The command's exit status and output depend on ICMP reachability, which is frequently blocked by network policies, firewall rules, or containers that lack ping binaries. A successful ping might still occur via cached /etc/hosts entries, and an unsuccessful ping could stem from ICMP filtering rather than a DNS fault, making it a misleading DNS diagnostic tool.
- ✗
kubectl exec -it pod-name -- /bin/sh
Why it's wrong here
kubectl exec -it pod-name -- /bin/sh merely opens an interactive shell inside an existing container; it performs no name resolution against the cluster's DNS service. It might be a first step before running dig, nslookup, or cat /etc/resolv.conf, but by itself it cannot confirm or refute DNS failures. Furthermore, the command assumes the pod is Running and has a shell, so the common failure modes (e.g., CrashLoopBackOff or lack of /bin/sh) are totally unrelated to DNS.
- ✓
dig kubernetes.default.svc.cluster.local
Why this is correct
dig is a dedicated DNS lookup utility that sends explicit DNS queries to the configured resolver and prints the full DNS response, including the resolved A/AAAA record and the answer section. When invoked from inside a pod, it directly interrogates the cluster DNS service (usually CoreDNS) for kubernetes.default.svc.cluster.local, so a successful answer proves that DNS resolution works end-to-end. It also distinguishes error types such as NXDOMAIN versus SERVFAIL, which makes it highly effective for isolating DNS-specific misconfigurations.
- ✗
curl http://kubernetes.default.svc.cluster.local
Why it's wrong here
curl uses HTTP (or other protocols) to fetch a resource from a given URL; while it resolves the hostname first, its outcome is dominated by whether the target service is actually listening and serving the requested path. If the service is down or returns a connection refused error, curl fails even when DNS is perfectly healthy, and if it succeeds, it only proves that both DNS and the application layer work. As a result, curl conflates DNS health with application availability, making it a poor standalone test for a suspected DNS issue.
- ✓
nslookup kubernetes.default.svc.cluster.local
Why this is correct
nslookup is a simple, interactive DNS query tool that sends a direct query for the given name to the nameserver and reports the resolved IP address. Running nslookup for kubernetes.default.svc.cluster.local from within a pod isolates DNS behavior because it does not depend on any higher-level protocol or application endpoint — only on the cluster's DNS resolving the service name. Its concise output and widespread availability in images like nginx or busybox (though sometimes via the dnsutils package) make it a practical choice for quick DNS verification.
Visual reference
Go deeper
Related to this question
Learn chapter
Kubernetes Architecture Overview
Key term
Ingress Resources
Ingress Resources are Kubernetes API objects that manage external access to services inside a cluster, typically HTTP and HTTPS traffic, by defining rules for routing requests based on hostnames and paths.
Key term
kubectl Command Reference
kubectl is the command-line tool used to interact with and manage Kubernetes clusters by sending commands to the Kubernetes API.
About these practice questions
This CKA question is part of Courseiva's 726-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.