liveBook · Manning

Nslookup

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

nslookup is a command-line utility that queries DNS servers for domain and resource-record information.

nslookup is a command-line DNS utility for checking whether a container can reach and resolve names through the configured Kubernetes DNS server. Run it inside the relevant network namespace when node-level tests are inconclusive. section 8.1.2 section 6.1

Use nslookup as an operational DNS check:

  • Create or reuse a diagnostic pod, such as a dnstools or netshoot container, and open a shell with kubectl exec. section 8.1.2 section 6.1
  • Query a Kubernetes name, such as nslookup kubernetes, to inspect the response from the cluster DNS path. section 8.1.2
  • Query an external name, such as nslookup example.com, to verify that CoreDNS and the pod's resolver configuration work together. section 6.1
  • Inspect /etc/resolv.conf alongside the result; its nameserver entry identifies the DNS service being queried. section 8.1.2 section 6.1

Verify external DNS from a pod

Run kubectl exec -it netshoot -- bash, then execute nslookup example.com. A successful response reports server 100.96.0.10 and resolves example.com to several addresses, confirming the configured CoreDNS path. section 6.1

bash-5.1# nslookup example.com
Server:    100.96.0.10
Address:    100.96.0.10#53

Name:    example.com
Address: 23.220.75.245
Name:    example.com
Address: 23.192.228.80
Name:    example.com
Address: 23.215.0.138
Name:    example.com
Address: 23.215.0.136
Name:    example.com
Address: 23.192.228.84
Name:    example.com
Address: 23.220.75.232

View representative nslookup output showing the queried server and returned addresses. section 6.1

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains the command through practical pod workflows and output checks, but does not detail DNS protocol internals.
Examples
Uses nslookup kubernetes for a cluster name and nslookup example.com for external resolution verification.
What it assumes
Assumes familiarity with kubectl run, kubectl exec, shells, pods, and basic Kubernetes DNS configuration.
What you can do after
Diagnose/debug with it by testing cluster and external name resolution from a running diagnostic pod.
How it connects
Connects DNS queries with CoreDNS, Kubernetes Services, pod network namespaces, and /etc/resolv.conf.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.