问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/43141109/how-can-i-enable-reverse-dns-lookups-with-kube-dns-on-pod-ip