kubernetes - Istio Ingress TLS 使用 ACM:上游连接错误或在标头之前断开/重置。重置原因:连接终止
问题描述
我尝试按照#6566中的说明使用 SSL 设置 aws 负载均衡器 (ELB)
证书附在 ELB 上。
但是,当我尝试在浏览器上访问我们的网络时,我遇到了“上游连接错误或在标头之前断开/重置。重置原因:连接终止”的问题。
我们之前没有使用 SSL 的设置。
我使用自定义 values.yaml 来安装 istio(helm 模板):
helm 模板 ./istio/install/kubernetes/helm/istio --name istio --namespace istio-system --values ./mesh/values.yaml | kubectl 应用 -f -
我在gateways
标签下面插入了注释:
istio-ingressgateway:
serviceAnnotations:
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:ap-southeast-1:xxxxx:certificate/my-crt"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
这是我的gateway.yaml
:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: istio-gateway
spec:
selector:
istio: ingressgateway #default istio ingressgateway
servers:
- port:
number: 80
name: http-istio-gateway
protocol: HTTP
hosts:
- "*"
tls:
httpsRedirect: true
- port:
number: 443
name: https-istio-gateway
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: api-gateway
spec:
gateways:
- istio-gateway
hosts:
- "*"
http:
- match:
- uri:
prefix: /socket.io/
route:
- destination:
host: api-gateway-ws.default.svc.cluster.local
port:
number: 5001
- match:
- uri:
prefix: /
route:
- destination:
host: api-gateway.default.svc.cluster.local
port:
number: 5000
解决方案
我已经通过更新 VirtualService 清单解决了这个问题。
不确定添加多个“匹配”时为什么会发生错误。
...
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: api-gateway
spec:
gateways:
- istio-gateway
hosts:
- "*"
http:
- match:
- uri:
prefix: "/socket.io"
route:
- destination:
host: api-gateway-ws.default.svc.cluster.local
port:
number: 5001
websocketUpgrade: true
- route:
- destination:
host: api-gateway.default.svc.cluster.local
port:
number: 5000
推荐阅读
- datetime - 如何手动从时间戳中提取一天中的小时?
- r - 为 R 中的每个分类值创建列
- python - 如何在循环中检查值?
- azure - 如何创建从 Azure AppService 部署 MSIX 安装程序所需的文件?
- android - Android 库是否可以将样式、颜色保密?
- java - 如何在 Spring Boot 中正确显示 DTO
- ssl - 如何知道是自签名证书还是内部 CA 签名证书
- usb - USB:DATA0 还是 DATA1 是在控制事务的数据阶段发送的吗?
- php - 如何删除 I/O 警告无法加载外部实体
- python - Python 和 API 输出到 CSV