Skip to content

Kubernetes DNS

Cluster DNS: CoreDNS vs Kube-DNS DNS for Services and Pods

Coredns

kubectl -n kube-system get pods -l k8s-app=kube-dns
kubectl -n kube-system get service kube-dns
dig @10.43.0.10 ix.de
dig @10.43.0.10 helm-operator.oas.svc.cluster.local

Troubleshoot

Start a new debug pod in kube-system namespace:

kubectl -n kube-system run -it --rm debug --image=docker.io/nicolaka/netshoot \
  --restart=Never -- sh

Attach an interactive debug container to coredns pod:

kubectl -n kube-system debug -it --rm --image=nicolaka/netshoot \
  coredns-54996dc9b4-q98mv

Show content of /etc/resolv.conf in coredns container:

kubectl -n kube-system debug -i --rm --image=nicolaka/netshoot \
  coredns-54996dc9b4-q98mv -- sh -c 'cat /etc/resolv.conf'

General DNS troubleshooting

kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml
kubectl get pods dnsutils
kubectl exec -i -t dnsutils -- nslookup kubernetes.default