Istio Ingress TLS使用ACM:上游连接错误或在标头之前断开连接/重置。重置原因:连接终止

时间:2019-05-19 09:03:35

标签: kubernetes istio

我尝试按照#6566上的说明使用SSL设置AWS负载均衡器(ELB)

证书附在ELB上。

但是,在尝试通过浏览器访问我们的网站时,出现了“ 上游连接错误或在标头之前断开连接/重置。重置原因:连接终止”的问题。

我们以前没有SSL的设置就可以使用。

我使用自定义values.yaml安装istio(头盔模板):

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

1 个答案:

答案 0 :(得分:0)

我已经通过更新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