Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GKE: ingress loadbalancer does not use configured static IP

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

like image 914
Matthias Avatar asked Jan 29 '19 13:01

Matthias


People also ask

How do I assign a static IP to ingress?

To acquire a static IP for the ingress-nginx-controller, simply put it behind a Service of Type=LoadBalancer . Then, update the ingress controller so it adopts the static IP of the Service by passing the --publish-service flag (the example yaml used in the next step already has it set to "ingress-nginx-lb").

How do I set a static IP address for Kubernetes load balancer?

To create a LoadBalancer service with the static public IP address, add the loadBalancerIP property and the value of the static public IP address to the YAML manifest. Create a file named load-balancer-service. yaml and copy in the following YAML. Provide your own public IP address created in the previous step.

What is difference between LoadBalancer and ingress?

While ingresses and load balancers have a lot of overlap in functionality, they behave differently. The main difference is ingresses are native objects inside the cluster that can route to multiple services, while load balancers are external to the cluster and only route to a single service.

What is Kubernetes IO ingress global static IP name?

The kubernetes.io/ingress.global-static-ip-name annotation specifies the name of the global IP address resource to be associated with the HTTP(S) Load Balancer. Note: Provisioning and configuring the load balancer might take a few minutes.


1 Answers

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

like image 51
Matthias Avatar answered Dec 03 '22 16:12

Matthias