我在将纯Kubernetes应用迁移到Istio托管应用时遇到问题。我使用的是Google Cloud Platform(GCP)、Istio 1.4、Google Kubernetes Engine(GKE)、Sping Boot 和JAVA 11。
我让容器在纯GKE环境中运行,没有任何问题。现在我开始迁移我的Kubernetes集群以使用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)
我的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
为了应用yaml文件,我使用了以下参数:
kubectl apply -f <(istioctl kube-inject -f ./tree-guest.yaml)
在部署应用程序后,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
如果有人知道哪里出了问题,请告诉我。我已经被这个问题困了好几天了。
- 谢谢-谢谢
1条答案
按热度按时间htzpubme1#
正如@维克托提到的,这里的问题是错误的yaml文件。
我解决了它。在我的情况下yaml文件是错误的。我检查了它,现在问题解决了。谢谢你们。,-维克托
如果你正在寻找yaml的例子,我建议你看看istio github samples。
由于
503 upstream connect error or disconnect/reset before headers. reset reason: connection failure
经常发生,我设置了小故障排除答案,还有另一个问题与503错误,我遇到了几个月的答案,有用的信息,从istio文档和我会检查的东西。503错误示例:
istio文档中的503错误的常见原因:
我会先检查几件事:
<protocol>[-<suffix>]
。kubectl get namespace -L istio-injection