本文介绍了GKE:入口负载平衡器不使用配置的静态IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在GCP中使用Terraform创建了一个全局静态IP地址.但是,当我尝试将其分配给GKE集群内的入口控制器时,它将被忽略:

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:

这是我的kubernetes配置:

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:
    # ...

此处引用的IP地址如下:

the IP address referenced here looks like this:

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

但是,Ingress不会使用该IP地址,而是使用另一个随机IP地址.这是一个很大的问题,因为我没有使用Google的DNS服务,因此我需要依靠静态IP.

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

推荐答案

愚蠢的我-它不是全球IP地址.在这种情况下,只会分配一个随机的新对象

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

这篇关于GKE:入口负载平衡器不使用配置的静态IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 14:00