Richard
Richard

Reputation: 45

Are Kubernetes pods that use host networking assigned a pod IP that can be accessed using a Service resource?

If a Kubernetes pod is defined with host network enabled, is the application running on this pod accessible from the Service resource using the app selector?

Upvotes: 2

Views: 12648

Answers (2)

Vadim Eisenberg
Vadim Eisenberg

Reputation: 3427

You can create Services for pods on host network in the same way as Services for pods on pod network.

This is what I experienced in my Kubernetes cluster, and I did not see any documentation that explicitly states that Services will not work with pods on host network.

Upvotes: 0

Arghya Sadhu
Arghya Sadhu

Reputation: 44657

Host network means it will use the host system's network. Services are created in pod network which is separate. So it can not be accessed that way. You can access a pod with host network directly using the IP of the host system. You should avoid using host network though for various reasons.

Here is an article to understand it more deeply.

Upvotes: 12

Related Questions