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.
Asked
Active
Viewed 2,884 times
1 Answers
1
(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.

Maxym
- 659
- 5
- 11
-
I think that issue is about hostNetworked services discover the nonHostNetworked service. My question is how does a regular pod send traffic to hostNetworked pod through the service abstraction? – hobgoblin Jan 02 '17 at 07:00
-
Oh, you are right. Misunderstood your question. You may try to manually create an endpoint for your service and point it to the host ip. – Maxym Jan 03 '17 at 10:19
-
I did similar thing with 2 different solutions, one is to create a k8s deployment to proxy request to host network IPs (using nginx as it's an HTTP service), the other one, I use externalName (check http://kubernetes.io/docs/user-guide/services/#services-without-selectors). – Hang Jan 05 '17 at 02:37