我正在运行 2 个 ingress-nginx 控制器,一个是外部的,一个是内部的,一切正常,流量正在流动,但由于某种原因,我的 kubernetes 入口资源没有显示控制器的地址
Every 2.0s: kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
my-app-external nginx-external my.app.com 80, 443 21h
一切正常,但地址没有显示让我很困扰;我的控制器已正确部署
Every 2.0s: kubectl get services -n ingress-nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-external-ingress-nginx-controller LoadBalancer 10.191.93.78 <pub_ip> 80:30470/TCP,443:31251/TCP 10d
nginx-external-ingress-nginx-defaultbackend ClusterIP 10.191.95.41 <none> 80/TCP 10d
nginx-internal-ingress-nginx-controller LoadBalancer 10.191.71.162 10.227.13.2 80:31858/TCP,443:30080/TCP 10d
nginx-internal-ingress-nginx-defaultbackend ClusterIP 10.191.78.126 <none> 80/TCP 10d
ingress-nginx/ingress-nginx helm 图表的值如下所示
# internal
controller:
ingressClassResource:
name: "nginx-internal"
controllerValue: "k8s.io/internal-ingress-nginx"
service:
annotations:
cloud.google.com/load-balancer-type: "Internal"
networking.gke.io/internal-load-balancer-allow-global-access: "true"
和
# external
controller:
ingressClassResource:
name: "nginx-external"
controllerValue: "k8s.io/external-ingress-nginx"
我的 kubernetes 入口资源看起来像这样
apiVersion: networking.k8s.io/v1
kind: Ingress
...
spec:
ingressClassName: "nginx-external"
我的 IngressClass 看起来像这样
Every 2.0s: kubectl get ingressclass
NAME CONTROLLER PARAMETERS AGE
nginx-external k8s.io/external-ingress-nginx <none> 21h
nginx-internal k8s.io/internal-ingress-nginx <none> 3d21h
最重要的是,在此更改之前,我正在运行相同的外部和内部入口,controllerValue
因此入口类看起来像这样
Every 2.0s: kubectl get ingressclass MacBook-Pro-5.local: Tue Dec 7 12:31:02 2021
NAME CONTROLLER PARAMETERS AGE
nginx-external k8s.io/ingress-nginx <none> 21h
nginx-internal k8s.io/ingress-nginx <none> 3d21h
一切正常!!!!!!,但该场景中的入口显示错误的地址并显示它们与错误的入口控制器通信;像这样(注意外部和内部都显示外部IP)
Every 2.0s: kubectl get ingress MacBook-Pro-5.local: Tue Dec 7 12:33:30 2021
NAME CLASS HOSTS ADDRESS PORTS AGE
tst-my-app-1 nginx-external tst-my.app.domain <pub_ip> 80, 443 180d
tst-my-app-2 nginx-internal tst-my.app2.domain <pub_ip> 80 206d
...
而且他们工作正常!!,流量按预期进行-从我的角度来看,这只是一个视觉错误)-我的问题是,其他人也遇到过吗?或者知道如何修复它并使 kubernetes 正确显示入口从控制器获取的地址?