Clients see the real source IP as a node IP, not the client IP. How do you preserve it?
IntermediateScenarioServices, Ingress and DNS
Answer
Situation read → An allowlist in the app breaks because every request appears to come from inside the cluster.
What I'd do →
- For a LoadBalancer or NodePort Service set
externalTrafficPolicy: Local - Or use NLB with proxy protocol and configure the app or ingress to read it
- For ALB read
X-Forwarded-Forand trust only the LB ranges - Make sure the pods are spread so every LB target node has a pod
- Verify with an echo service that prints headers
Why → Cluster policy SNATs traffic to balance across nodes, which hides the original address.
Interview tip → Mention the trade-off: Local can create uneven load.
More on Services, Ingress and DNS
A Service has no endpoints. How do you find out why?BeginnerWhen do you use ClusterIP, NodePort, LoadBalancer and ExternalName?BeginnerTraffic to a Service works from some pods but times out from others. How do you debug it?AdvancedYou want to expose three HTTP services under one hostname with different paths. How?Intermediateingress-nginx returns 404 for a new host. What do you check?Intermediateingress-nginx returns 502 or 503 intermittently. What are the likely reasons?Intermediate