<p>I'm running an nginx service in a docker container with Google Container Engine which forwards specific domain names to other services, like API, Frontend, etc. I have simple cluster for that with configured services. Nginx Service is Load Balance.</p>

<p>The REMOTE_ADDR environmental variable always contains an internal address in the Kubernetes cluster. I looked for is HTTP_X_FORWARDED_FOR but it's missing from the request headers. Is it possible to configure the service to save the external client ip in the requests?</p>

<p>With the current implementation of L3 balancing (as of Kubernetes 1.4) it isn't possible to get the source IP address for a connection to your service. </p>

<p>It sounds like your use case might be well served by using an <a href="http://kubernetes.io/docs/user-guide/ingress/" rel="nofollow">Ingress</a> object (or by manually creating an <a href="https://cloud.google.com/compute/docs/load-balancing/http/" rel="nofollow">HTTP/S load balancer</a>), which will put the source IP address into a the <code>X-Forwarded-For</code> HTTP header for easy retrieval by your backends. </p>
