<p>i installed nginx ingress with the yaml file</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.2.0/deploy/static/provider/cloud/deploy.yaml
</code></pre>
<p>when deploy i can see that the endpoints/externalIPs by default are all the ip of my nodes
<a href="https://i.stack.imgur.com/Cdtuj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cdtuj.png" alt="enter image description here" /></a></p>
<p>but i only want 1 externalIPs to be access able to my applications</p>
<p>i had tried bind-address(<a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#bind-address" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#bind-address</a>) in a configuration file and applied it but it doesn't work, my ConfigMap file:</p>
<pre><code>apiVersion: v1
data:
  bind-address: &quot;192.168.30.16&quot;
kind: ConfigMap
metadata:
  name: ingress-nginx-controller
</code></pre>
<p>I tried <code>kubectl edit svc/ingress-nginx-controller -n ingress-nginx</code> to edit the svc adding externalIPs but it still doesn't work.</p>
<p><a href="https://i.stack.imgur.com/RQKdy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RQKdy.png" alt="enter image description here" /></a></p>
<p>The only thing the nginx ingress document mentioned is <a href="https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#external-ips" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#external-ips</a> but i tried editing the svc, after i changed, it was set to single IP, but later it re-add the IPs again. Seems like there an automatic update of external IPs mechanic in ingress-nginx?</p>
<p>Is there anyway to set nginx ingress externals ip to only 1 of the node ip? i'm running out of option for googling this. Hope someone can help me</p>

<blockquote>
<p>but I only want 1 external IPs to be access able to my applications</p>
</blockquote>
<p>If you wish to &quot;control&quot; who can access your service(s) and from which ip/subnet/namesapce etc you should use <code>NetworkPolicy</code></p>
<hr />
<p><a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/network-policies/</a></p>
<blockquote>
<p>The entities that a Pod can communicate with are identified through a combination of the following 3 identifiers:</p>
<ol>
<li>Other pods that are allowed (exception: a pod cannot block access to itself)</li>
<li>Namespaces that are allowed.</li>
<li>IP blocks (exception: traffic to and from the node where a Pod is running is always allowed, regardless of the IP address of the Pod or the node)</li>
</ol>
<p>When defining a pod- or namespace-based NetworkPolicy, you use a selector to specify what traffic is allowed to and from the Pod(s) that match the selector.</p>
<p>Meanwhile, when IP-based NetworkPolicies are created, we define policies based on IP blocks (CIDR ranges).</p>
</blockquote>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: test-network-policy
  namespace: default
spec:
  podSelector:
    matchLabels:
      role: db
  policyTypes:
    - Ingress
    - Egress
  ingress:
    - from:
        - ipBlock:
            cidr: 172.17.0.0/16
            except:
              - 172.17.1.0/24
        - namespaceSelector:
            matchLabels:
              project: myproject
        - podSelector:
            matchLabels:
              role: frontend
      ports:
        - protocol: TCP
          port: 6379
  egress:
    - to:
        - ipBlock:
            cidr: 10.0.0.0/24
      ports:
        - protocol: TCP
          port: 5978
</code></pre>
<hr />
<p><a href="https://i.stack.imgur.com/OufJL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OufJL.jpg" alt="enter image description here" /></a></p>
