当前位置:   article > 正文

Istio 报错503,upstream connect error or disconnect/reset before headers. reset reason: connect_istio 503 rst

istio 503 rst

错误描述:
每一次在升级微服务时(更新微服务版本),会有一段时间访问报 503 。并在 istio-proxy 日志中有记录:”upstream connect error or disconnect/reset before headers. reset reason: connection failure“

原因:
Kubernetes 检测 Pod 准备好(Running 状态)是 Pod 中的一个容器准备好就可以了。但是部署了 Istio 后,Pod 最先准备好的是 istio-proxy 容器。此时真正的微服务容器还没有被启动,流量就进入了 Pod,istio-proxy 接受到流量,并发现 upstream 微服务没有启动,所以 istio-proxy 会返回 503 。

解决办法:
知道原因后,思路就很简单了,只要在 Pod 中所有容器都启动完成后,再告知 Kubernetes Pod 准备好了就可以了。对 Pod 中其他容器加上 readinessProbe(就绪探针)就可以让 Kubernetes 确认容器准备就绪后再进行流量转发。如在 Pod 模板中添加

livenessProbe:
      httpGet:
        path: /healthz
        port: 80
        httpHeaders:
      initialDelaySeconds: 10
      periodSeconds: 3
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

readinessProbe 参考:https://k8smeetup.github.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/915636
推荐阅读
相关标签
  

闽ICP备14008679号