<p>I have number of IPs and I want only to allow those IP into my ingress</p>
<p>I know I can do this with in my ingress annotations,</p>
<p>nginx.ingress.kubernetes.io/whitelist-source-range: 10.0.0.0/16</p>
<p>But what I want is that I have multiple IPS and not only <code>10.0.0.0/16</code>
So If for example I have IPs like <code>178.1.0.2/17</code>,<code>10.0.0.0/16</code>,<code>178.2.0.3/18</code> and I only want to allow this IPs to my ingress then how can I acheive that.</p>

<p>If you are using <a href="https://kubernetes.github.io/ingress-nginx/" rel="nofollow noreferrer">Nginx Ingress</a> you can do it adding specific annotation <code>whitelist-source-range</code>.</p>
<p><a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#whitelist-source-range" rel="nofollow noreferrer">nginx.ingress.kubernetes.io/whitelist-source-range</a></p>
<blockquote>
<p>You can specify allowed client IP source ranges through the nginx.ingress.kubernetes.io/whitelist-source-range annotation. The value is a comma separated list of CIDRs, e.g. 10.0.0.0/24,172.10.0.1.</p>
</blockquote>
<p>To configure this setting globally for all Ingress rules, the whitelist-source-range value may be set in the NGINX ConfigMap.</p>
<p><strong>Also keep in mind that:</strong></p>
<blockquote>
<p>Adding an annotation to an Ingress rule overrides any global restriction.</p>
</blockquote>
<p>Also if you would like to use <code>Ingress Whitelist IP for Path</code> you can check <a href="https://stackoverflow.com/questions/58925853/kubernetes-ingress-whitelist-ip-for-path/59052066">this thread</a>.</p>
<p><strong>Example:</strong></p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: frontend
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/whitelist-source-range: 10.0.0.0/16,178.2.0.3/18,178.1.0.2/17
spec:
  rules:
    - host: something.something.com
      http:
        paths:
          - path: /app1
            backend:
              serviceName: app1
              servicePort: 80
          - path: /api
            backend:
              serviceName: api
              servicePort: 8000

ingress.extensions/frontend created
</code></pre>
