An application requires Pods to communicate using hostNetwork: true. Which Kubernetes resource is still necessary for stable DNS names?
Trap 1: Headless Service
A headless Service (clusterIP: None) intentionally omits a stable virtual IP, so its DNS name resolves to the individual pod IPs (or node IPs under hostNetwork) rather than a consistent endpoint. That means clients cannot rely on a fixed address for the Service, and any pod restart or reschedule changes the DNS results. Although useful for stateful pod discovery, it fails when an application requires a stable, load-balanced communication endpoint.
Trap 2: Endpoints resource
The Endpoints resource is merely an internal API object that enumerates the backing pod IPs and ports selected by a Service; it is not a separate traffic-routing mechanism. In practice, the Service controller populates Endpoints automatically, and clients never address the Endpoints object directly. Even with hostNetwork, Endpoints carry no stable IP or DNS name of their own, so relying on Endpoints alone for pod communication is not a valid architectural choice.
Trap 3: Ingress
Ingress is a Layer-7 construct designed to route external HTTP/HTTPS traffic from outside the cluster to Services, usually through an Ingress controller. It does not provide internal service discovery or a stable IP for pod-to-pod communication within the cluster. Even if the application uses hostNetwork, Ingress remains irrelevant and cannot substitute for a ClusterIP Service's DNS name and stable endpoint for East-West traffic.
- A
Headless Service
Why it fails: A headless Service (clusterIP: None) intentionally omits a stable virtual IP, so its DNS name resolves to the individual pod IPs (or node IPs under hostNetwork) rather than a consistent endpoint. That means clients cannot rely on a fixed address for the Service, and any pod restart or reschedule changes the DNS results. Although useful for stateful pod discovery, it fails when an application requires a stable, load-balanced communication endpoint.
- B
Endpoints resource
Why it fails: The Endpoints resource is merely an internal API object that enumerates the backing pod IPs and ports selected by a Service; it is not a separate traffic-routing mechanism. In practice, the Service controller populates Endpoints automatically, and clients never address the Endpoints object directly. Even with hostNetwork, Endpoints carry no stable IP or DNS name of their own, so relying on Endpoints alone for pod communication is not a valid architectural choice.
- C
Regular Service (ClusterIP)
A regular ClusterIP Service establishes a stable virtual IP and a fixed DNS hostname (e.g., service.namespace.svc.cluster.local), and kube-proxy load-balances traffic to selected pods. It works with hostNetwork because the Service selects pods by labels; the endpoints simply reference the node IP where the hostNetwork pod runs, and the virtual IP remains consistent regardless of the pod's network mode. This gives applications a reliable, unchanging internal communication address, exactly what is needed.
- D
Ingress
Why it fails: Ingress is a Layer-7 construct designed to route external HTTP/HTTPS traffic from outside the cluster to Services, usually through an Ingress controller. It does not provide internal service discovery or a stable IP for pod-to-pod communication within the cluster. Even if the application uses hostNetwork, Ingress remains irrelevant and cannot substitute for a ClusterIP Service's DNS name and stable endpoint for East-West traffic.