【发布时间】:2021-01-11 16:58:30
【问题描述】:
我正在使用 AWS EKS 服务(K8S 版本 1.17)运行一个 kubernetes 集群,并在其上安装了 Istio (1.7.1) 作为 Operator 安装。
我一直在运行这些服务,因为它们工作正常,而且我正在运行 Istio Ingress Gateway 作为入口服务,使用 AWS NLB 发布,在 Istio Ingress Gateway 上带有以下注释:
metadata:
annoations:
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "tcp"
service.beta.kubernetes.io/aws-load-balancer-internal: "false"
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "redacted arn"
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
这成功创建了具有 4 个侦听器(根据 Istio 入口定义)的 NLB,其中 443 使用提供的证书运行 TLS。
在它后面的网关配置如下:
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: service-gateway
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: grpc-plain
protocol: GRPC
hosts:
- redacted
- port:
number: 443
name: grpc-tls
protocol: GRPC
hosts:
- redacted
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: service-vservice
namespace: app
spec:
gateways:
- istio-system/service-gateway
hosts:
- redacted
http:
- route:
- destination:
host: service
port:
number: 8000
但是,虽然普通端口 (80) 与负载平衡器配合得很好,但 SSL/TLS 端口 443 使用任何语言(使用 C、C++、Python 测试)都会出现以下错误:
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
debug_error_string = "{"created":"@1601027790.018488379","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":4089,"referenced_errors":[{"created":"@1601027790.018476348","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":393,"grpc_status":14}]}"
>
例如,Python 客户端已初始化如下:
import grpc
from service_pb2_grpc import ServiceStub
creds = grpc.ssl_channel_credentials()
with grpc.secure_channel(url, creds) as channel:
grpc_client = ServiceStub(channel)
在使用简单客户端时出现此错误,我做错了什么?
【问题讨论】:
标签: ssl kubernetes grpc istio amazon-eks