Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsMedium

A DevOps engineer is troubleshooting a Pod that is exhibiting high latency when communicating with an external database. The Pod's YAML manifest includes a `hostNetwork: true` setting. How does this setting affect the Pod's networking?

  1. AThe Pod's containers can only communicate with other Pods on the same node.
  2. BThe Pod's network traffic is routed through the kube-proxy on the worker node.
  3. CThe Pod shares the network namespace with the host, bypassing Kubernetes networking.
  4. DThe Pod is assigned a dedicated IP address from the Kubernetes service CIDR.
Show answer & explanation

Correct answer: C. The Pod shares the network namespace with the host, bypassing Kubernetes networking.

When `hostNetwork: true` is set, the Pod's containers use the network namespace of the host node. This means the Pod's network interfaces are directly exposed to the host's network, bypassing the standard Kubernetes network plugin and CNI, and the Pod can use any port on the host's IP address.

Why the other options are wrong

  • A. This is incorrect; it can communicate with anything the host can, not just other Pods on the same node.
  • B. While kube-proxy runs on the node, `hostNetwork: true` bypasses the typical CNI and Pod networking model that kube-proxy usually interacts with for Service routing.
  • D. This is incorrect; `hostNetwork: true` means it uses the host's IP, not an IP from the service CIDR.

Pod hostNetwork

A Pod configuration that allows its containers to use the network namespace of the host node, effectively bypassing the Kubernetes network model.

  • Pod shares host's network stack.
  • Bypasses CNI plugin networking.
  • Pod's ports are directly on the host's IP.

Memory trick: HostNetwork: Pod's network is the Host's network!

More Kubernetes Fundamentals questions