Search code examples
kubernetesreverse-dnskube-dns

How can I enable reverse DNS lookups with kube-dns on pod IP?


is it possible to do a reverse DNS lookup from one pod to another in the same namespace on Kuberenetes? Setup: Kubernetes 1.5, kube-dns 1.9

When I exec a pod with nslookup I don't get a hostname but only a nslookup timeout like:

$ time kubectl exec mypod -- nslookup 172\.18\.14\.13

nslookup: can't resolve '(null)': Name does not resolve Name:     
172.18.14.13 Address 1: 172.18.14.13

real 0m5.592s

mypod2 does have the internal IP 172.18.14.13. Both mypod and mypod2 have been deployed to the same namespace (default).

A nslookup from mypod to mypod works:

$ time kubectl exec mypod -- nslookup 172\.18\.58\.13
nslookup: can't resolve '(null)': Name does not resolve

Name:      172.18.58.13
Address 1: 172.18.58.13 mypod

real    0m0.403s

Do I have to configured something special or isn't it possible by design?


Solution

  • The conclusion is that it's impossible by design.

    General pod ip reverse lookup require a lot of work in kubedns and kubernetes, and this does not have many use cases. While headless services dns reverse lookup is supported after kubedns 1.11.

    You can get more discussion about this in issue#33470 and PR#25