Courseiva
TroubleshootingmediumMultiple ChoiceObjective-mapped

CKA Troubleshooting Practice Question

You suspect a DNS issue inside a pod. Which command can you run to test DNS resolution from within a pod?

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

kubectl exec <pod-name> -- nslookup kubernetes.default

The correct command to test DNS resolution from within a pod is `kubectl exec <pod-name> -- nslookup kubernetes.default`. This runs the nslookup command inside an existing pod, directly testing DNS resolution from that pod's perspective. Option A (kubectl logs coredns) shows CoreDNS logs, not a DNS test. Option B (kubectl describe svc kubernetes) shows service details, not DNS resolution. Option C (kubectl run test --image=busybox -- nslookup kubernetes.default) creates a new pod to run the command, but the question asks for testing from within an existing pod, so exec is appropriate.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • kubectl logs coredns -n kube-system

    Why it's wrong here

    `kubectl logs coredns -n kube-system` streams the logs from the CoreDNS pod(s) running in the cluster. While these logs can reveal server-side errors, refused queries, or panic messages, they do not send a query from an application pod and cannot confirm whether the pod's resolver is configured correctly. Moreover, CoreDNS does not log every successful lookup unless verbose logging is explicitly enabled, so a clean log does not guarantee that a given pod can resolve `kubernetes.default`.

  • kubectl describe svc kubernetes

    Why it's wrong here

    `kubectl describe svc kubernetes` displays the Kubernetes service object's metadata, including its ClusterIP, ports, and current endpoints. It reads from the cluster's API server, not from inside any pod, so it cannot exercise the pod's DNS resolver or its /etc/resolv.conf configuration. Even if the service were absent, this command would still succeed, making it useless for detecting DNS resolution failures from a workload's perspective.

  • kubectl run test --image=busybox -- nslookup kubernetes.default

    Why it's wrong here

    This command creates a new pod running the `nslookup` command, which can test DNS resolution, but it requires creating a new pod rather than using an existing one. While it could work, it is not the most direct method when a pod already exists.

  • kubectl exec <pod-name> -- nslookup kubernetes.default

    Why this is correct

    `kubectl exec <pod-name> -- nslookup kubernetes.default` runs the `nslookup` binary directly inside the target pod's network namespace. This uses the pod's own `/etc/resolv.conf`, including its `nameserver` (typically the kube-dns ClusterIP) and search domains (such as `default.svc.cluster.local`), to perform a real DNS query. It is the most direct way to verify that the pod can resolve a service name, because it replicates exactly what an application in that pod would experience.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

This CKA question is part of Courseiva's 302-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 →

How Courseiva writes practice questions · Editorial policy

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.