<p>I have an ingress controller in a GKE cluster with <code>ingress.class</code>:</p>
<pre><code>kubernetes.io/ingress.class: &quot;nginx&quot;
</code></pre>
<p>I wish to assign a static ip to this ingress controller. I followed this tutorial for creating and assigning the static ip:</p>
<p><a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip" rel="nofollow noreferrer">https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip</a></p>
<p>Basically I reserved a static IP and tried to assign it to the ingress using:</p>
<pre><code>kubernetes.io/ingress.global-static-ip-name: &quot;my-ingress-static-ip&quot;
</code></pre>
<p><strong>The Problem</strong></p>
<p>The ip address ingress did not changed to the new assigned static ip.</p>
<p>How should I assign this static IP to the ingress?</p>
<p><strong>My Configuration</strong></p>
<p>Controller deployed using:</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.40.2/deploy/static/provider/cloud/deploy.yaml
</code></pre>
<p>My Ingress yaml:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: api-ingress
  namespace: development
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/backend-protocol: &quot;HTTPS&quot;
    kubernetes.io/ingress.class: &quot;nginx&quot;
    # Disallow http - Allowed only with gce controller
    # kubernetes.io/ingress.allow-http: &quot;false&quot;
    # Enable client certificate authentication
    nginx.ingress.kubernetes.io/auth-tls-verify-client: &quot;on&quot;
    # Create the secret containing the trusted ca certificates
    nginx.ingress.kubernetes.io/auth-tls-secret: &quot;development/api-ingress-ca-secret&quot;
    # Specify the verification depth in the client certificates chain
    nginx.ingress.kubernetes.io/auth-tls-verify-depth: &quot;1&quot;
    # Automatically redirect http to https
    nginx.ingress.kubernetes.io/force-ssl-redirect: &quot;true&quot;
    # Use regex in paths
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    # For notifications we add the proxy headers
    nginx.ingress.kubernetes.io/configuration-snippet: |  
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection &quot;upgrade&quot;;
    # Set a static ip for the ingress
    kubernetes.io/ingress.global-static-ip-name: &quot;my-ingress-static-ip&quot;
spec:
  tls:
    - hosts:
      - my-host.com
      secretName: api-tls-certificate
  rules:
  - host: my-host.com
    http:
      paths:
      - path: /(v[0-9]/.*)
        backend:
          serviceName: my-service
          servicePort: 443
      
</code></pre>
<p>Deleting the ingress or the controller did not fixed the problem.</p>

<p>That tutorial is only for the GCE ingress controller.</p>
<blockquote>
<p>Note: This tutorial does not apply to the NGINX Ingress Controller.</p>
</blockquote>
<p>To set the IP address, you need to specify the actual ip address in the <code>spec:</code> <a href="https://github.com/kubernetes/ingress-nginx/blob/fb6a03ffb42cfbf682c3c7f400f46fb4802caa1c/deploy/static/provider/cloud/deploy.yaml#L286" rel="nofollow noreferrer">section</a> of the LoadBalancer service.</p>
<pre><code>spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  loadBalancerIP: ACTUAL.IP.ADRESS.HERE
  ports:
</code></pre>
<p>As a note, make sure that your ip address is a regional static IP and not a global IP. This took me quite a while to figure out.</p>
