Interview Prep/Networking/Kubernetes Networking

What does hostNetwork: true do and why is it risky?

IntermediateScenarioKubernetes Networking
Answer

Situation read → The pod shares the node's network namespace.

What I'd do →

  1. The pod uses the node IP and ports directly, bypassing the pod network
  2. Used by CNI agents, node exporters and some ingress controllers
  3. Risks: port conflicts, bypasses NetworkPolicy, can see node traffic
  4. Check usage with kubectl get pods -A -o jsonpath='{range .items[?(@.spec.hostNetwork==true)]}{.metadata.name}{"\n"}{end}'
  5. Use admission policy to restrict

Why → It breaks the isolation boundary that namespaces and policies rely on.

Interview tip → Say you allow it only for system components.

All Networking questions Roadmap: Networking for DevOps

More on Kubernetes Networking