无法访问在 kubernetes 集群中安全运行的 gRPC 服务

时间:2021-07-26 22:59:43

标签: kubernetes grpc kubernetes-ingress

我在从节点/集群外部连接到在 kubernetes 中运行的 gRPC 应用程序时遇到问题。在集群内部,连接正常工作,在集群外部,我收到以下错误:

注意:集群内外的服务使用相同的 gRPC 客户端进行连接。

在服务器端:

ssl_transport_security.cc:1824] No match found for server name: <myDomain.com>

在客户端:

    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.UNAVAILABLE
    details = "failed to connect to all addresses"
    debug_error_string = "{"created":"@1627334018.361000000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":5420,"referenced_errors":[{"created":"@1627334018.361000000","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":398,"grpc_status":14}]}"
>

Kubernetes 设置如下:

  • 具有在安全通道上运行的 gRPC 应用的部署
  • 运行使用 nodePorts 将节点绑定到 pod 端口的服务。例如安全通道为0.0.0.0:50051,服务节点端口配置如下: <块引用>

    节点端口:30001 端口:50051 目标端口:50051

  • SSL 证书/密钥被设置为不透明的秘密,集群内的其他服务使用它来访问 gRPC 应用程序。 SSL 证书是使用正确的替代名称创建的,其中之一是我创建的 gRPC Kubernetes 服务的服务名称。这些服务可以毫无问题地连接到 gRPC 应用

如果我理解正确,这应该将任何流量路由到节点上的 30001,到 Pod 上的 50051。

问题:

  • 由于我运行的是安全通道,因此我认为我的 gRPC 服务器上发生了 SSL 终止。怎么可能在集群内部,SSL 在其他服务连接到该服务时正常工作,但在外部却失败了?

0 个答案:

没有答案