study.

Checking Cluster DNS · CKA

Observe how a Service name resolves to an IP address.

← CKA

Learn with progress and quizzes

First, understand the concepts.

DNS names

You can use a short Service name within the same namespace. Use service-name.namespace to identify a Service in another namespace.

Separate the failure modes

Distinguish a failed DNS lookup from a failed connection. Even if the name resolves, a selector, port, or NetworkPolicy issue can block the connection.

Why it matters

An application may resolve web in one namespace but fail after moving to another. Short names depend on the calling Pod’s DNS search path.

Work through the reasoning

Compare short and qualified names

web normally resolves in the caller’s namespace. Use web.<namespace>.svc to distinguish another namespace. The cluster domain is configurable, so cluster.local is not universal.

Separate DNS from HTTP

Record whether the resolved address matches the expected Service, then test connectivity from the same client. Successful nslookup confirms a DNS response, not HTTP health.

Learn by doing.

You need kubectl and access to your own practice Kubernetes cluster. Each lab is independent. Check your current context first, then run the commands in your own terminal.

Use a temporary Pod to look up the default kubernetes Service. The temporary Pod is removed when the command finishes.

kubectl run study-dns --image=busybox:1.36 --restart=Never --rm -i -n default -- nslookup kubernetes.default
kubectl get service kubernetes -n default
kubectl get pods -n kube-system -l k8s-app=kube-dns

How to check your result

Compare the resolved address with the kubernetes Service’s ClusterIP. The cluster DNS domain depends on the installation configuration.

Apply what you learned

A Pod in team-a calls web in team-b. Does failure to resolve web prove CoreDNS is broken?

Reveal the reasoning after trying

First make the target explicit as web.team-b.svc. If that also fails, inspect the Pod’s resolv.conf, DNS Service and endpoints, and the policies or connectivity on the DNS path.

Ready to check your understanding?

Which name identifies the api Service in the team-a namespace?

  1. api.team-a
  2. team-a.api.node
  3. api.localhost
  4. api/NodePort
Reveal the reasoning after trying

api.team-a

api.team-a includes both the Service name and namespace. A fully qualified DNS name also includes the cluster domain.

Kubernetes documentation