【问题标题】:Istio causing frequent disconnection in grpc streamIstio 导致 grpc 流中频繁断开连接
【发布时间】:2020-03-06 13:01:11
【问题描述】:

我正在尝试通过 istio 入口将外部世界的 grpc 流设置到 istio 集群中。我能够建立连接,但我看到连接每 60 秒重置一次。

容器日志在中断前告诉“rpc 错误:code = Unavailable desc”

查看了入口和特使日志。没什么帮助。附在下面。

INGRESS LOGS
[2020-03-06T12:14:10.221Z] "- - -" 0 - "-" "-" 2679 2552 9993 - "-" "-" "-" "-" "10.244.0.93:5448" outbound|5448||grpc-broker.x-infra.svc.cluster.local 10.244.0.116:58094 10.244.0.116:443 10.222.2.9:37864 <xxxxxx DNS NAME xxxxxxxx> -

ENVOY LOGS
[2020-03-06T12:16:28.331Z] "- - -" 0 - "-" "-" 12021 2733 50282 - "-" "-" "-" "-" "127.0.0.1:5448" inbound|5448|tcp-broker|grpc-broker.x-infra.svc.cluster.local 127.0.0.1:56816 10.244.0.93:5448 10.244.0.116:34782 outbound_.5448_._.grpc-broker.x-infra.svc.cluster.local -

我们是否应该向 grpc 流添加任何额外的东西才能工作?

集群默认启用 mTLS,源和目标 pod 是部署而不是有状态设置。

【问题讨论】:

  • 嗨,你有什么版本的 istio?您是否在任何地方配置了超时?许多 grpc API 的默认超时时间为 60 秒。
  • 我用的是最新的1.4.5版本。我自己没有配置任何超时,但 istio 可能在某些配置中自动设置了它。知道在哪里可以检查 API 超时吗?

标签: grpc istio grpc-go


【解决方案1】:

从 istio 端确保 istio 没有关闭连接。:

这可以通过DestinationRule 中的idleTimeout 设置来防止。

根据 istio documentation 关于idleTimeout

上游连接池连接的空闲超时。空闲超时定义为没有活动请求的时间段。如果未设置,则没有空闲超时。当达到空闲超时时,连接将被关闭。请注意,基于请求的超时意味着 HTTP/2 PING 不会使连接保持活动状态。适用于 HTTP1.1 和 HTTP2 连接。

所以如果你像这样制作DestinationRule

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: grpc-iddletimeout-policy
spec:
  host: grpcservice.servicenamespace.svc.cluster.local
  trafficPolicy:
    connectionPool:
      http:
        idleTimeout: 2m

这应该会在 servicenamespace 命名空间中的 grpcservice 空闲 2 分钟后关闭来自 Istio 特使代理端的任何 HTTP/2 连接。

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-10
    • 1970-01-01
    • 2019-05-30
    • 1970-01-01
    • 1970-01-01
    • 2016-08-22
    • 2015-04-28
    相关资源
    最近更新 更多