<p>I am trying to whitelist IP(s) on the ingress in the AKS. I am currently using the <code>ingress-nginx</code> not installed with Helm. </p>

<p>The mandatory kubernetes resources  can be found <a href="https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml" rel="nofollow noreferrer">here</a> </p>

<p>The service is started as:</p>

<pre><code>spec:
  externalTrafficPolicy: Local
</code></pre>

<p>Full yaml <a href="https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/cloud-generic.yaml" rel="nofollow noreferrer">here</a></p>

<p>My ingress definition is:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: example-ingress
  # namespace: ingress-nginx
  annotations:
    ingress.kubernetes.io/rewrite-target: /
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/whitelist-source-range: "xxx.xxx.xxx.xxx"
spec:
  rules:
  - http:
      paths:
      - path: /xx-xx
        backend:
          serviceName: xx-xx
          servicePort: 8080
      - path: /xx
        backend:
          serviceName: /xx
          servicePort: 5432
</code></pre>

<p>The IP whitelisting is not enforced. Am I doing something wrong ?</p>

Segmented
<p>After a lot of digging around I found that the problem is because of this bug in NATing, defined <a href="https://github.com/Azure/AKS/issues/785" rel="nofollow noreferrer">here</a> and there is quick medium read <a href="https://medium.com/@chatelain.io/aks-azure-kubernetes-service-ingress-ip-filtering-whitelisting-issue-c194190df696" rel="nofollow noreferrer">here</a>.</p>

<p>Hope this solves problems for future readers or help track the bug</p>
