GCP 负载均衡器或 Kubernetes 类型 = LoadBalancer
GCP Load Balancer or Kubernetes type = LoadBalancer
使用 Google 容器引擎时 - 人们会推荐 GCP 的本地负载均衡器还是 Kubernetes 服务类型 = LoadBalancer 选项?
人们推荐哪个?
在 Google 容器引擎上将服务类型设置为 LoadBalancer
将为您配置 GCP 负载均衡器。参见 Creating an External Load Balancer and Services: Type LoadBalancer。
在服务资源清单中,如果您设置Type
to LoadBalancer
,Kubernetes on GKE(Google容器引擎)将使用GCE自动设置TCP负载平衡(L4 Load balancer)。您将必须使用自己的自定义服务器或类似 nginx
/apache
.
的方式终止 Pod 中的连接
如果您的目标是设置 L7 负载均衡器 (HTTP/HTTPS),最好使用 Ingress
resource in Kubernetes(从 v1.1
开始)。 GKE 将为此设置自动设置 GCE HTTP/HTTPS L7 负载平衡。此设置具有以下优点:
- 根据 URL 路径和端口指定服务(它使用 GCE 中的
URL Maps
来配置它)。
- 在 GCE 负载均衡器上设置和终止 SSL/TLS(它使用 GCE 的
Target proxies
来配置它)。
- GKE 也会自动为您的服务配置 GCE
health checks
。
有关 GKE page about setting up HTTP load balancing 的更多信息。
请记住,GKE 将自动为上述两种用例使用可用的 GCE 负载均衡器支持,您无需手动设置 GCE load balancing。
使用 Google 容器引擎时 - 人们会推荐 GCP 的本地负载均衡器还是 Kubernetes 服务类型 = LoadBalancer 选项?
人们推荐哪个?
在 Google 容器引擎上将服务类型设置为 LoadBalancer
将为您配置 GCP 负载均衡器。参见 Creating an External Load Balancer and Services: Type LoadBalancer。
在服务资源清单中,如果您设置Type
to LoadBalancer
,Kubernetes on GKE(Google容器引擎)将使用GCE自动设置TCP负载平衡(L4 Load balancer)。您将必须使用自己的自定义服务器或类似 nginx
/apache
.
如果您的目标是设置 L7 负载均衡器 (HTTP/HTTPS),最好使用 Ingress
resource in Kubernetes(从 v1.1
开始)。 GKE 将为此设置自动设置 GCE HTTP/HTTPS L7 负载平衡。此设置具有以下优点:
- 根据 URL 路径和端口指定服务(它使用 GCE 中的
URL Maps
来配置它)。 - 在 GCE 负载均衡器上设置和终止 SSL/TLS(它使用 GCE 的
Target proxies
来配置它)。 - GKE 也会自动为您的服务配置 GCE
health checks
。
有关 GKE page about setting up HTTP load balancing 的更多信息。
请记住,GKE 将自动为上述两种用例使用可用的 GCE 负载均衡器支持,您无需手动设置 GCE load balancing。