我曾经使用过在亚马逊网络服务中部署的Openshift/OKD集群,在那里可以将集群连接到来自Route53的某个域名。然后,一旦我部署了带有一些主机映射的入口(在ingres中定义的主机是基础域的子域),所有必要的lb规则( Openshift中的路由)和子域本身都是由Openshift创建的,并且可以直接使用。例如: Openshift接入了在Route53中注册的域名somedomain.com。在入口中,我有如下的主机映射:
hosts:
- host: sub1.somedomain.com
paths:
- path部署后,我可以访问sub1.somedomain.com。GKE中有这种功能吗?到目前为止,我只看到映射到静态IP。
此外,我在这里提出了https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-http2,如果我需要连接服务与入口,服务必须是NodePort类型。真的是这样吗?在Openshift中,不需要任何普通的ClusterIP服务都可以连接到入口。
提前感谢!
发布于 2021-05-06 22:39:51
我认为您应该为您的用例考虑其他Ingress Controllers。
我不是GKE的专家,但正如我所看到的那样,你需要考虑如何通过像OpenShift这样的通配符子域来路由多个Best practices for enterprise multi-tenancy主机名。
Set up HTTP(S) Load Balancing with Ingress
:
You can create and configure an HTTP(S) load balancer by creating a Kubernetes Ingress resource,
which defines how traffic reaches your Services and how the traffic is routed to your tenant's application.
By registering Services with the Ingress resource, the Services' naming convention becomes consistent,
showing a single ingress, such as tenanta.example.com and tenantb.example.com.路由功能基本上依赖于Ingress Controllers。在我的发现中,GKE的默认入口控制器只创建了一个Google Cloud HTTP(S)负载均衡器,但它在默认情况下并不像OpenShift那样考虑多租户。
相比之下,在OpenShift中,入口控制器是使用具有动态配置功能的HAProxy实现的,如下所示。
LB -tenanta.example.com--> HAProxy(directly forward the tenanta.example.com traffic to the target pod IPs) ---> Target Pods发布于 2021-05-07 00:12:01
服务公开的类型取决于每个云提供商上的K8S实现。
因此,在您的案例中,要么在NodePort中公开您的服务,要么使用本地安装在集群中的另一个入口控制器配置GKE,而不是默认使用这个控制器。
https://stackoverflow.com/questions/67416649
复制相似问题