首页 > 解决方案 > GKE cluster - can I direct traffic from global http load balancer to nginx ingress controller

问题描述

I'm using GKE and I installed nginx ingress controller on the cluster. GCP created automatically a TCP load balancer to redirect the request from the external ephemeral IP to my cluster nodes (nginx).

I have another a web application deployed on a VM, and I'd like to balance the incoming requests by subdomain between VM and gke cluster. In order to do that I created a global load balancer with 2 backends and the host and path rules.

I configured DNS record A to point the Global load balancer.

I can reach the VM from my domain but I cannot reach the ingresses installed on GKE.

I tried to configure the gke-backend as instance group (node pool) and as Internet network endpoint group pointing to TCP load balancer. But without success :-(

How can I balance between a VM and GKE cluster in GCP?

标签: nginxgoogle-cloud-platformload-balancinggoogle-kubernetes-enginenginx-ingress

解决方案


通常不这样做。首先,您不能让 HTTP(S) 负载平衡器以网络负载平衡器为目标。LB 必须指向由网络端点组或实例组组成的后端服务。

唯一可行的方法是使用包含所有当前节点的非托管实例组。然后,您可以将非托管实例组作为后端服务添加到您的 HTTP(S) LB,指定 Nginx Ingress nodePort 作为后端端口。

上述问题在于,当任何集群节点发生变化(扩展、缩减或因升级而被替换)时,非托管实例组不会自动更新为新节点。您将需要手动使组保持最新。


推荐阅读