<p>I have a python program that fetches the client IP using request.client.host headers and Fast API.
This program is running on a kubernetes pod(ip-pod).
I have another Gateway API implemented using KrakenD and this runs on another pod in kubernetes cluster.
The Kubernetes yaml files for both(ip-pod and KrakenD) have the property <code>externalTrafficPolicy: Local</code>
I am unable to retrieve the real IP of the user and this could be because KrakenD is not allowing the real IP to reach to the ip-pod.
I have tested the program by exposing the ip-pod to the internet using <code>type: LoadBalancer</code> and that way it gives the correct client IP. But when I use the KrakenD gateway, the IP is something different(private IP).</p>

<p>You can use the no-op with krakenD which will forward request to the backend</p>
<p><a href="https://www.krakend.io/docs/endpoints/no-op/" rel="nofollow noreferrer">https://www.krakend.io/docs/endpoints/no-op/</a></p>
<p>you can check parameter forwarding config in your YAML of KrakenD also</p>
<pre><code>&quot;headers_to_pass&quot;:[  
      &quot;*&quot;
]
</code></pre>
<p>If you are getting client IP in header KrakenD will forward it to backend.</p>
<p><a href="https://www.krakend.io/docs/endpoints/parameter-forwarding/#sending-all-client-headers-to-the-backends" rel="nofollow noreferrer">https://www.krakend.io/docs/endpoints/parameter-forwarding/#sending-all-client-headers-to-the-backends</a></p>
<p>Refrence</p>
<pre><code>{
              &quot;endpoint&quot;: &quot;/api/v1/{uid}/user&quot;,
              &quot;method&quot;: &quot;GET&quot;,
              &quot;headers_to_pass&quot;: [ &quot;*&quot; ],
              &quot;querystring_params&quot;: [ &quot;*&quot; ],
              &quot;output_encoding&quot;: &quot;no-op&quot;,
              &quot;concurrent_calls&quot;: 1,
              &quot;backend&quot;: [
                  {
                      &quot;url_pattern&quot;: &quot;/api/{uid}/user&quot;,
                      &quot;encoding&quot;: &quot;no-op&quot;,
                      &quot;host&quot;: [
                          &quot;http://IP:Port&quot;
                      ]
                  }
              ]
          }
</code></pre>
