GKE: ingress loadbalancer does not use configured static IP

1/29/2019

I've created a global static IP Address using terraform in GCP. However, when I try to assign it to an ingress controller inside a GKE cluster, it gets ignored:

Here's my kubernetes configuration:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
    name: homefully-ingress
    annotations:
        kubernetes.io/ingress.global-static-ip-name: "homefully-ingress-root"   
    labels:
        app: homefully-ingress
spec:
    # ...

the IP address referenced here looks like this:

NAME                    REGION        ADDRESS        STATUS
homefully-ingress-root  europe-west3  35.234.83.106  RESERVED

However, ingress does not use that IP Address but another random one. That's quite a problem, as I am not using google's DNS services, so I need to rely on a static IP.

Instead, this is what I am getting:

Name:             homefully-ingress
Namespace:        default
Address:          35.227.252.112
Default backend:  auth-proxy-staging:4180 (10.4.0.7:4180)
Rules:
  Host                       Path  Backends
  ----                       ----  --------
  adminpanel.homefully.tech
                                homefully-management-frontend-website-staging:80 (10.4.2.7:80)
Annotations:
  kubectl.kubernetes.io/last-applied-configuration:  {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.class":"gce","kubernetes.io/ingress.global-static-ip-name":"homefully-ingress-root"},"labels":{"app":"homefully-ingress"},"name":"homefully-ingress","namespace":"default"},"spec":{"backend":{"serviceName":"auth-proxy-staging","servicePort":4180},"rules":[{"host":"adminpanel.homefully.tech","http":{"paths":[{"backend":{"serviceName":"homefully-management-frontend-website-staging","servicePort":80}}]}}]}}

  kubernetes.io/ingress.class:                  gce
  kubernetes.io/ingress.global-static-ip-name:  homefully-ingress-root
  ingress.kubernetes.io/backends:               {"k8s-be-31611--026ed6556721059b":"Unknown","k8s-be-32450--026ed6556721059b":"Unknown"}
  ingress.kubernetes.io/forwarding-rule:        k8s-fw-default-homefully-ingress--026ed6556721059b
  ingress.kubernetes.io/target-proxy:           k8s-tp-default-homefully-ingress--026ed6556721059b
  ingress.kubernetes.io/url-map:                k8s-um-default-homefully-ingress--026ed6556721059b
Events:
  Type    Reason  Age   From                     Message
  ----    ------  ----  ----                     -------
  Normal  ADD     8m    loadbalancer-controller  default/homefully-ingress
  Normal  CREATE  7m    loadbalancer-controller  ip: 35.227.252.112

I can't find an error message or any hint on what's wrong here. Would be very thankful for some suggestions

-- Matthias Huttar
google-cloud-platform
google-kubernetes-engine
kubernetes-ingress

1 Answer

1/29/2019

stupid me - it was not a global ip address. in which case just a random new one got assigned

-- Matthias Huttar
Source: StackOverflow