<p>I have services with ClusterIP in Kubernetes and using <code>nginx</code> (<a href="https://github.com/helm/charts/tree/master/stable/nginx-ingress" rel="nofollow noreferrer">https://github.com/helm/charts/tree/master/stable/nginx-ingress</a>) to expose these services to the internet. When I try to get client IP address in application I am getting cluster's node IP. How can I retrieve actual client IP?</p>

<p>I looked into <code>"externalTrafficPolicy": "Local"</code> settings in service but for that service type must be <code>LoadBalancer</code>.</p>

<p>I also tried update ingress annotations with:</p>

<pre><code>nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,X-Forwarded-For,csrf-token"
nginx.ingress.kubernetes.io/cors-allow-origin: "https://example.com"
</code></pre>

<p>But, still, it's not working. Please advice!</p>

<p>This is unfortunately not possible today. Please see <a href="https://github.com/kubernetes/kubernetes/issues/67202" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/67202</a> and <a href="https://github.com/kubernetes/kubernetes/issues/69811" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/69811</a> for more discussion around this.</p>

<p>If you want to get the client IP address, you'll need to use <code>NodePort</code> or <code>LoadBalancer</code> types.</p>
