How does service discovery work for pods with hostNetwork=true

12/29/2016

If the hostNetwork is set to true in pod spec, it receives the same IP address as host. While the pod can be reached at with this ip, I am not able to reach the pod through a service. If I set the clusterIP to None in service, the dns lookup doesn't return any results. If a clusterIP is assigned, traffic is not redirected to the backend pod.

-- hobgoblin
kube-dns
kubernetes

1 Answer

12/30/2016

(definitely wrong, misunderstood the question) The problem is in /etc/resolv.conf

When using hostNetwork=true you get host's dns servers and you don't have cluster dns there.

Track issue on github

-- Maxym
Source: StackOverflow