<p>Given a K8s cluster on GCP with a service configured with:</p>
<pre class="lang-yaml prettyprint-override"><code>externalTrafficPolicy: Local
</code></pre>
<p>and the pod behind the service being an Nginx container.</p>
<p>How can I get the client source IP?</p>
<p>The current issue I don't get client real IP, I get k8s cluster node kind of IP</p>

bitgandtter
<p>There a <a href="https://stackoverflow.com/questions/4880283/how-to-pass-the-remote-ip-to-a-proxied-service-nginx">similar answer here</a>. Make sure that your nginx has the following configuration in your <code>server</code> block:</p>
<pre><code>proxy_set_header X-Real-IP $remote_addr;
</code></pre>
<p>If you are using an Nginx ingress controller it should be the <a href="https://kubernetes.github.io/ingress-nginx/user-guide/miscellaneous/#source-ip-address" rel="nofollow noreferrer">default behavior</a>.</p>
