Link Search Menu Expand Document

kubernetes DNS Cheat Sheet

Pod DNS Name

Easiest way for lookup is dumping /etc/resolv.conf

sh-4.2# cat /etc/resolv.conf
search test.svc.cluster.local svc.cluster.local cluster.local eu-west-1.compute.internal
options ndots:5

So this pod can be reached via <name>.test.svc.cluster.local with <name> being the deployment name and test being the namespace.

Pod DNS Policy

kubectl get pod <name> -o "jsonpath={.spec.dnsPolicy}"

usually returns ClusterFirst indicating internal resolution.


Adding an external nameserver

This is done using the forward plugin. Add a server section to your Corefile like this {
   forward .

this would resolve via Cloudflare DNS.