Interview Prep/Networking/Kubernetes Networking

Your app needs the real client IP behind a Kubernetes LoadBalancer service. What do you do?

IntermediateScenarioKubernetes Networking
Answer

Situation read → kube-proxy SNATs traffic when it forwards across nodes, hiding the client IP.

What I'd do →

  1. Set externalTrafficPolicy: Local on the Service, which sends traffic only to nodes with local pods and keeps the source IP
  2. The cloud health check then marks nodes without pods unhealthy automatically
  3. Or use PROXY protocol or X-Forwarded-For on an L7 LB
  4. Verify by logging the remote address in the app
  5. Spread pods across nodes with topology spread constraints

Why → Cluster policy balances evenly but loses the client IP; Local keeps it with possible imbalance.

Interview tip → Say the trade-off is uneven load.

All Networking questions Roadmap: Networking for DevOps

More on Kubernetes Networking