简体   繁体   English

上游连接错误或在标头之前断开连接/重置。 重置原因:连接失败。 Spring 引导和 java 11

[英]upstream connect error or disconnect/reset before headers. reset reason: connection failure. Spring Boot and java 11

I'm having a problem migrating my pure Kube.netes app to an Istio managed.我在将我的纯 Kube.netes 应用程序迁移到 Istio 托管时遇到问题。 I'm using Google Cloud Platform (GCP), Istio 1.4, Google Kube.netes Engine (GKE), Spring Boot and JAVA 11.我正在使用谷歌云平台 (GCP)、Istio 1.4、谷歌 Kube.netes 引擎 (GKE)、Spring Boot 和 JAVA 11。

I had the containers running in a pure GKE environment without a problem.我让容器在纯 GKE 环境中运行没有问题。 Now I started the migration of my Kube.netes cluster to use Istio.现在我开始迁移我的 Kube.netes 集群以使用 Istio。 Since then I'm getting the following message when I try to access the exposed service.从那时起,当我尝试访问公开的服务时,我收到了以下消息。

upstream connect error or disconnect/reset before headers.上游连接错误或在标头之前断开连接/重置。 reset reason: connection failure重置原因:连接失败

This error message looks like a really generic.这个错误信息看起来很普通。 I found a lot of different problems, with the same error message, but no one was related to my problem.我发现了很多不同的问题,都有相同的错误信息,但没有一个与我的问题有关。

Bellow the version of the Istio:下面是 Istio 的版本:

client version: 1.4.10
control plane version: 1.4.10-gke.5
data plane version: 1.4.10-gke.5 (2 proxies)

Bellow my yaml files:下面是我的 yaml 文件:

apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    account: tree-guest
  name: tree-guest-service-account
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: tree-guest
    service: tree-guest
  name: tree-guest
spec:
  ports:
  - name: http
    port: 8080
    targetPort: 8080
  selector:
    app: tree-guest
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: tree-guest
    version: v1
  name: tree-guest-v1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tree-guest
      version: v1
  template:
    metadata:
      labels:
        app: tree-guestaz
        version: v1
    spec:
      containers:
      - image: registry.hub.docker.com/victorsens/tree-quest:circle_ci_build_00923285-3c44-4955-8de1-ed578e23c5cf
        imagePullPolicy: IfNotPresent
        name: tree-guest
        ports:
        - containerPort: 8080
      serviceAccount: tree-guest-service-account
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: tree-guest-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
    - port:
        number: 80
        name: http
        protocol: HTTP
      hosts:
        - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: tree-guest-virtual-service
spec:
  hosts:
    - "*"
  gateways:
    - tree-guest-gateway
  http:
    - match:
        - uri:
            prefix: /v1
      route:
        - destination:
            host: tree-guest
            port:
              number: 8080

To apply the yaml file I used the following argument:为了应用 yaml 文件,我使用了以下参数:

kubectl apply -f <(istioctl kube-inject -f ./tree-guest.yaml)

Below the result of the Istio proxy argument, after deploying the application:部署应用程序后,在 Istio 代理参数的结果下方:

istio-ingressgateway-6674cc989b-vwzqg.istio-system SYNCED SYNCED SYNCED SYNCED 
istio-pilot-ff4489db8-2hx5f 1.4.10-gke.5 tree-guest-v1-774bf84ddd-jkhsh.default SYNCED SYNCED SYNCED SYNCED istio-pilot-ff4489db8-2hx5f 1.4.10-gke.5

If someone have a tip about what is going wrong, please let me know.如果有人知道出了什么问题,请告诉我。 I'm stuck in this problem for a couple of days.我被这个问题困了几天。

Thanks.谢谢。

As @Victor mentioned the problem here was the wrong yaml file.正如@Victor 提到的,这里的问题是错误的 yaml 文件。

I solve it.我解决它。 In my case the yaml file was wrong.在我的情况下,yaml 文件是错误的。 I reviewed it and the problem now is solved.我查看了它,现在问题已经解决了。 Thank you guys., – Victor谢谢你们。,-维克多

If you're looking for yaml samples I would suggest to take a look at istio github samples .如果您正在寻找 yaml 示例,我建议您查看istio github 示例


As 503 upstream connect error or disconnect/reset before headers. reset reason: connection failure作为503 upstream connect error or disconnect/reset before headers. reset reason: connection failure 503 upstream connect error or disconnect/reset before headers. reset reason: connection failure occurs very often I set up little troubleshooting answer, there are another questions with 503 error which I encountered for several months with answers, useful informations from istio documentation and things I would check. 503 upstream connect error or disconnect/reset before headers. reset reason: connection failure经常发生我设置了很少的故障排除答案,还有另一个问题与 503 错误,我遇到了几个月的答案,来自 istio 文档的有用信息和我会检查的东西。

Examples with 503 error:带有 503 错误的示例:

Common cause of 503 errors from istio documentation: istio 文档中 503 错误的常见原因:

Few things I would check first:我会先检查几件事:

  • Check services ports name, Istio can route correctly the traffic if it knows the protocol.检查服务端口名称,如果 Istio 知道协议,它可以正确路由流量。 It should be <protocol>[-<suffix>] as mentioned in istio documentation .它应该是istio 文档中提到的<protocol>[-<suffix>]
  • Check mTLS, if there are any problems caused by mTLS, usually those problems would result in error 503.检查mTLS,如果有mTLS引起的问题,通常这些问题会导致错误503。
  • Check if istio works, I would recommend to apply bookinfo application example and check if it works as expected.检查 istio 是否工作,我建议应用bookinfo 应用程序示例并检查它是否按预期工作。
  • Check if your namespace is injected with kubectl get namespace -L istio-injection检查你的命名空间是否注入kubectl get namespace -L istio-injection
  • If the VirtualService using the subsets arrives before the DestinationRule where the subsets are defined, the Envoy configuration generated by Pilot would refer to non-existent upstream pools.如果使用子集的 VirtualService 在定义子集的 DestinationRule 之前到达,Pilot 生成的 Envoy 配置将引用不存在的上游池。 This results in HTTP 503 errors until all configuration objects are available to Pilot.这会导致 HTTP 503 错误,直到所有配置对象都可用于 Pilot。

I landed exactly here with exactly similar symptoms.我正好降落在这里,症状完全相似。

But in my case I had to但就我而言,我不得不

switch pod listen address from 172.0.0.1 to 0.0.0.0将 pod 监听地址从 172.0.0.1 切换到 0.0.0.0

which solved my issue这解决了我的问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 上游连接错误或在标头之前断开/重置。 重置原因:使用 Spring Boot 时连接终止 - upstream connect error or disconnect/reset before headers. reset reason: connection termination when using Spring Boot 503 上游连接错误或在标头之前断开/重置。 重置原因:本地重置 - Spring - 503 upstream connect error or disconnect/reset before headers. reset reason: local reset - Spring 春季启动Oracle Exadata | 连接重置错误 - Spring Boot Oracle Exadata | Connection Reset error Spring Boot 文件上传 - 对等错误重置连接 - Spring Boot File Upload - Connection reset by peer error 连接重置 - 尝试使用TCPS连接尝试连接到AWS RDS时,在Spring Boot应用程序中获取问题 - Connection reset - issue getting in Spring Boot application while trying to connect to AWS RDS using TCPS connection spring 启动微服务给:java.net.SocketException: Connection reset - spring boot micro-service giving: java.net.SocketException: Connection reset Spring Boot,如何在每次测试前重置metrics registry? - In Spring Boot, how to reset the metrics registry before each test? 使用Hibernate和Oracle在Spring Boot应用程序中由对等方重置连接 - Connection reset by peer in Spring Boot application with Hibernate and Oracle haproxy + spring boot writeAddress(..)失败:对等重置连接 - haproxy + spring boot writeAddress(..) failed: Connection reset by peer 在 docker 容器中几分钟后重置 Spring Boot 连接 - Spring boot connection reset after a few minutes in docker container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM