<p>my web application is running as a Kubernetes pod behind an nginx reverse proxy for SSL. Both the proxy and my application use Kubernetes services for load balancing (as described <a href="http://blog.kubernetes.io/2015/07/strong-simple-ssl-for-kubernetes.html">here</a>).</p>

<p>The problem is that all of my HTTP request logs only show the internal cluster IP addresses instead of the addresses of the actual HTTP clients. Is there a way to make Kubernetes services pass this information to my app servers?</p>

<p>As of 1.5, if you are running in GCE (by extension GKE) or AWS, you simply need to add an annotation to your Service to make HTTP source preservation work.</p>

<pre><code>...
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/external-traffic: OnlyLocal
...
</code></pre>

<p>It basically exposes the service directly via nodeports instead of providing a proxy--by exposing a health probe on each node, the load balancer can determine which nodes to route traffic to.</p>

<p>In 1.7, this config has become GA, so you can set         <code>"externalTrafficPolicy": "Local"</code> on your Service spec.</p>

<p><a href="https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip" rel="noreferrer">Click here to learn more</a></p>
