<p>Our Kubernetes cluster includes an nginx load balancer that forwards the requests to other pods.</p>

<p>However, the nginx sees local source IPs and therefore cannot set the correct X-Real-IP header. I tried setting the externalTrafficPolicy value of nginx to "Local" but the IP does not change.</p>

<p>Section of the nginx service config:</p>

<pre><code> "selector": {
  "app": "nginx-ingress",
  "component": "controller",
  "release": "loping-lambkin"
},
"clusterIP": "10.106.1.182",
"type": "LoadBalancer",
"sessionAffinity": "None",
"externalTrafficPolicy": "Local",
"healthCheckNodePort": 32718
</code></pre>

<p>Result:</p>

<pre><code>GET / HTTP/1.1
Host: example.com:444
X-Request-ID: dd3310a96bf154d2ac38c8877dec312c
X-Real-IP: 10.39.0.0
X-Forwarded-For: 10.39.0.0
</code></pre>

<p>We use a bare metal cluster with metallb.</p>

Johannes Mittendorfer
<p>I found out that weave needs to be configured using <code>NO_MASQ_LOCAL=1</code> to respect the externalTrafficPolicy property</p>
