<p>I'm trying to pass my client IP address through my NGINX Ingress using Kubernetes on Azure</p>
<p>I've created this configmap for the NGINX config to add the headers:</p>
<pre><code>apiVersion: v1
data:
  X-Real-IP: $remote_addr;
  X-Forwarded-For: $proxy_add_x_forwarded_for;
  X-Forwarded-Proto: $proxy_x_forwarded_proto;
  use-forwarded-headers: &quot;true&quot;
  use-proxy-protocol: &quot;true&quot;
  real-ip-header: &quot;proxy_protocol&quot;
kind: ConfigMap
metadata:
  name: custom-headers
  namespace: default
</code></pre>
<p>Then added this config to reference the previous file:</p>
<pre><code>apiVersion: v1
data:
  proxy-set-headers: &quot;custom-headers&quot;
  externalTrafficPolicy: Local
kind: ConfigMap
metadata:
  name: ingress-nginx-controller
  namespace: default
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
</code></pre>
<p>If I describe my nginx controller:</p>
<pre><code>kubectl describe deploy ingress-nginx-controller
</code></pre>
<p>I can see the line:</p>
<pre><code>--configmap=$(POD_NAMESPACE)/ingress-nginx-controller
</code></pre>
<p>If I describe the ingress-nginx-controller configmap</p>
<pre><code>kubectl describe configmap ingress-nginx-controller
</code></pre>
<p>I can see the following in the data section:</p>
<pre><code>proxy-set-headers:
----
custom-headers
</code></pre>
<p>If I log out the nginx.conf file in my controller though, I can't see the changed values. For example this is still the default:</p>
<pre><code>proxy_set_header X-Forwarded-For        $remote_addr;
</code></pre>

<p>You are missing the namespace prefix for proxy-set-headers value. Because you have deployed <code>custom-headers</code> configmap to the default namespace, it should be</p>
<pre><code>data:
  proxy-set-headers: default/custom-headers
</code></pre>
