How does service discovery work for pods with hostNetwork=true

3k views Asked by At

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.

1

There are 1 answers

3
Maxym On

(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