简体   繁体   English

单个 GKE ingress controller 是否可以拥有多个 ingress 资源

[英]Is it possible to have multiple ingress resources with a single GKE ingress controller

In GKE Ingress documentation it states that:GKE Ingress 文档中,它指出:

When you create an Ingress object, the GKE Ingress controller creates a Google Cloud HTTP(S) Load Balancer and configures it according to the information in the Ingress and its associated Services.当您创建 Ingress object 时,GKE Ingress controller 会创建一个 Google Cloud HTTP(S) Load Balancer 并根据 Ingress 及其关联服务中的信息对其进行配置。

To me it seems that I can not have multiple ingress resources with single GCP ingress controller. Instead, GKE creates a new ingress controller for every ingress resource.在我看来,单个 GCP 入口 controller 无法拥有多个入口资源。相反,GKE 为每个入口资源创建一个新入口 controller。

Is this really so, or is it possible to have multiple ingress resources with a single ingress controller in GKE?真的是这样吗,还是说 GKE 中一个入口 controller 可以有多个入口资源?

I would like to have one GCP LoadBalancer as ingress controller with static IP and DNS configured, and then have multiple applications running in cluster, each application registering its own ingress resource with application specific host and/or path specifications.我想将一个 GCP LoadBalancer 作为入口 controller 配置为 static IP 和 DNS,然后让多个应用程序在集群中运行,每个应用程序使用特定于应用程序的主机和/或路径规范注册自己的入口资源。

Please note that I'm very new to GKE, GCP and Kube.netes in general, so it might be that I have misunderstood something.请注意,总的来说,我对 GKE、GCP 和 Kube.netes 很陌生,所以我可能误解了一些东西。

I think the question you're actually asking is slightly different than what you have written.我认为您实际提出的问题与您所写的略有不同。 You want to know if multiple Ingress resources can be linked to a single GCP Load Balancer, not GKE Ingress controller. Based on the concept of a controller , there is only one GKE Ingress controller in a cluster, which is responsible for fulfilling multiple resources and provisioning multiple load balancers.你想知道多个Ingress资源是否可以链接到单个GCP Load Balancer,而不是GKE Ingress controller。基于一个controller的概念,一个集群中只有一个GKE Ingress controller,负责完成多个资源和配置多个负载均衡器。

So, to answer the question directly (because I've been searching for a straight answer for a long time:):所以,直接回答这个问题(因为我一直在寻找一个直接的答案很长一段时间:):

Combining multiple Ingress resources into a single Google Cloud load balancer is not supported.不支持将多个 Ingress 资源合并到一个 Google Cloud 负载平衡器中。

Source: https://cloud.google.com/kube.netes-engine/docs/concepts/ingress来源: https://cloud.google.com/kube.netes-engine/docs/concepts/ingress

Sad.伤心。

However, using the nginx-ingress controller is one way to at least minimize the number of external (GCP) load balancers provisioned (it only provisions a single TCP load balancer), but since the load balancer is for TCP traffic, it cannot terminate SSL, or apply Firewall rules for you (Cloud Armor cannot be used, for instance).然而,使用 nginx-ingress controller 是一种至少减少所提供的外部 (GCP) 负载均衡器数量的方法(它只提供一个 TCP 负载均衡器),但由于负载均衡器用于 TCP 流量,它不能终止 SSL ,或为您应用防火墙规则(例如,无法使用 Cloud Armor)。

The only way I know of to have a single HTTPS load-balancer in GCP terminate SSL and route traffic to multiple services in GKE is to combine the ingresses into a single resource with all paths and certificates defined in one place.我知道在 GCP 中有一个 HTTPS 负载均衡器终止 SSL 并将流量路由到 GKE 中的多个服务的唯一方法是将入口组合到一个资源中,并将所有路径和证书定义在一个地方。

(If anybody figures out a way to do it with multiple separate ingress resources, I'd love to hear it!) (如果有人想出一种方法来使用多个单独的入口资源,我很乐意听到!)

Yes it is possible to have the single ingress controller for multiple ingress resources.是的,多个入口资源可以有一个入口 controller。

You can create multiple ingress resources as per path requirement and all will be managed by single ingress controller.您可以根据路径要求创建多个入口资源,所有入口资源都将由单个入口 controller 管理。

There are multiple ingress controller options also available you can use Nginx also that will create one LB and manage the paths.还有多个入口 controller 选项也可用,您也可以使用 Nginx,这将创建一个 LB 并管理路径。

Inside Kube.netes if you are creating a service with type LoadBalancer it will create the new LB resource in GCP so make sure your microservice type is ClusterIP and your all traffic goes inside K8s cluster via ingress path.在 Kube.netes 中,如果您正在创建类型为LoadBalancer的服务,它将在 GCP 中创建新的 LB 资源,因此请确保您的微服务类型是ClusterIP ,并且您的所有流量都通过入口路径进入 K8s 集群。

When you setup the ingress controller it will create one service with type LoadBalancer you can can use that IP in DNS servers to forward the subdomain and path to K8s cluster.当您设置入口 controller 时,它将创建一个类型为LoadBalancer的服务,您可以在 DNS 服务器中使用该 IP 将子域和路径转发到 K8s 集群。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM