首页 > 解决方案 > GKE 负载均衡器服务上的最大端口数

问题描述

问题

(外部)LB 服务可以在 GKE 上支持的最大端口数是多少?

背景

当端口数高于约 30 时,我们会遇到针对 LB 服务的超时。

超时向我表明,在修补新的 TCP 端口时,没有为服务创建防火墙规则。但是,手动添加相关的防火墙规则并不能解决问题。

因此,当服务端口计数过高时,服务本身可能无法将流量路由到相关 pod。

这些文档表明 50 个端口限制适用于内部 LB。想知道这对于外部是否相同?

更多信息

该端口肯定是在服务上创建的:

$ kubectl get svc -n router-proxy | tr ',' '\n' | grep 52220                                                                                       
52220:30142/TCP

我们可以使用 Pod IP 访问 Pod,但我们不能使用 Service 访问它们。

标签: kubernetesload-balancinggoogle-kubernetes-enginegke-networking

解决方案


使用 找到答案kubectl describe svc ...。每个服务的最大值似乎是 100 个端口。

  Warning  SyncLoadBalancerFailed  23s (x272 over 97m)    service-controller  (combined from similar events): Error syncing load balancer: failed to ensure load balancer: googleapi: Error 413: Value for field 'resource.allowed[0].ports' is too large: maximum size 100 element(s); actual size 494., fieldSizeTooLarge

推荐阅读