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
