如何在Pod IP上使用kube-dns启用反向DNS查找? [英] How can I enable reverse DNS lookups with kube-dns on pod IP?
问题描述
是否可以在Kuberenetes的同一名称空间中从一个Pod到另一个Pod进行反向DNS查找? 设置:Kubernetes 1.5,kube-dns 1.9
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
当我使用nslookup执行pod时,我没有主机名,而只有nslookup超时,如:
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
真实0m5.592s
real 0m5.592s
mypod2确实具有内部IP 172.18.14.13. mypod和mypod2都已部署到相同的名称空间(默认).
mypod2 does have the internal IP 172.18.14.13. Both mypod and mypod2 have been deployed to the same namespace (default).
从mypod到mypod的nslookup作品:
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?
推荐答案
结论是设计上不可能.
一般的ip ip反向查询需要在kubedns和kubernetes中进行大量工作,并且这没有很多用例.在Kubedns 1.11之后,支持无头服务dns反向查找.
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.
您可以在 issue#33470 和 PR#25
这篇关于如何在Pod IP上使用kube-dns启用反向DNS查找?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!