具有 HTTPS 后端的 VirtualService

VirtualService with a HTTPS backend

我有一个带有自签名 SSL 证书的服务,我想将其公开到 Internet。我希望 Istio Gateway 终止 SSL 连接(使用来自证书管理器的证书)和 istio sidecar 来处理后端服务内部的 HTTPS 流量。

然而,当我尝试这个时,我收到来自 Envoy 的错误:

TLS error: 268435648:SSL routines:OPENSSL_internal:PEER_DID_NOT_RETURN_A_CERTIFICATE

我的后端服务是这样暴露的:

---
kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
  name: stratos
  namespace: stratos
spec:
  gateways:
    - cf-system/istio-ingressgateway
  hosts:
    - console.example.com
  http:
    - route:
        - destination:
            host: console-ui-ext
            
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: stratos
  namespace: stratos
spec:
  host: console-ui-ext
  trafficPolicy:
    tls:
      mode: SIMPLE

---
kind: Gateway
SNIP
  - hosts:
    - console.example.com
    port:
      name: https-workloads
      number: 443
      protocol: HTTPS
    tls:
      credentialName: my-cert
      mode: SIMPLE

在 istio-sidecar 中,我可以 curl -k https://localhost 毫无问题。但是,当我使用 curl -k https://console-ui-ext.stratos.svc.cluster.local

时出现 SSL 错误

我错过了什么?我觉得奇怪的一件事是添加到 Envoy 的路由都是 outbound|443 我希望在那里也能看到入站路由。我不想在网关上进行 TLS 直通,因为后端服务的证书无效。

Istio 正在使用 STRICT mTLS 设置。

有 HTTPS 后端时我忘记了一个步骤吗?

原来这是因为 mTLS 很严格。 Sidecar 并没有预料到只有 TLS 流量到达才导致了这个问题。为此应用禁用 mTLS 解决了我的问题。

apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: stratos
  namespace: stratos
spec:
  mtls:
    mode: DISABLE