<p>I would like to create an nginx-ingress that I can link to a reserved IP address. The main reason being, that I want to minimize manual steps. Currently, the infrastructure is automatically set-up with Terraform, but I cannot get nginx-ingress to use the reserved IP with it. I already have nginx-ingress working, but it creates its own IP address.</p>

<p>According to the nginx-ingress site (<a href="https://kubernetes.github.io/ingress-nginx/examples/static-ip/" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/examples/static-ip/</a>), this should be possible. First, one should create a load-balancer service:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: nginx-ingress-lb
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  externalTrafficPolicy: Local
  type: LoadBalancer
  loadBalancerIP: 34.123.12.123
  ports:
  - port: 80
    name: http
    targetPort: 80
  - port: 443
    name: https
    targetPort: 443
  selector:
    # Selects nginx-ingress-controller pods
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
</code></pre>

<p>However, then one can update the IP via <code>nginx-ingress-controller.yaml</code> file with the <code>--publish-service</code> flag. However, I install this via helm:</p>

<pre><code>helm install stable/nginx-ingress --name my-nginx --set rbac.create=true
</code></pre>

<p>How can I link the publish service to nginx-ingress-lb in my helm installation (or upgrade).</p>

<p>Assuming your cloud provider supports LBs with static IPs (AWS, for example, will give you a CNAME instead of an IP): </p>

<p>You will have to set it as a tag as the following. Once you do this, you can set your ingress annotation: <code>kubernetes.io/ingress.class: nginx</code> and your ingress will automatically get the same IP address.</p>

<pre><code>helm install stable/nginx-ingress  --set controller.service.loadBalancerIP=XXXX,rbac.create=true
</code></pre>
