nginx - 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?
解决方案
通常不这样做。首先,您不能让 HTTP(S) 负载平衡器以网络负载平衡器为目标。LB 必须指向由网络端点组或实例组组成的后端服务。
唯一可行的方法是使用包含所有当前节点的非托管实例组。然后,您可以将非托管实例组作为后端服务添加到您的 HTTP(S) LB,指定 Nginx Ingress nodePort 作为后端端口。
上述问题在于,当任何集群节点发生变化(扩展、缩减或因升级而被替换)时,非托管实例组不会自动更新为新节点。您将需要手动使组保持最新。
推荐阅读
- html - Facebook评论插件黑暗模式不起作用
- javascript - 登录WithEmailAndPassword时Firebase Firestore权限被拒绝错误
- python - flask_sqlalchemy 的未解决导入
- reactjs - 我如何等待 AsyncStorage 的结果?
- sql - 来自关系的 Laravel Eloquent 联合模型
- python - Brew 升级 python 返回“python 未安装”
- apache-camel - 为什么 CAMEL-CDI 不能与骆驼 3 一起使用,这可能是 POM 依赖项的问题吗?
- javascript - Github auth 在 jquery 上运行良好,但在 react.js 上不行
- sql - 如何在sql中获取平均时间
- python - 如何根据连续性拆分时间序列索引