Istio 网关无法通过 HTTPS 连接

Istio Gateway Fail To Connect Via HTTPS

使用 Istio 的 GKE 集群中的部署通过 HTTP 正常工作。但是当我尝试使用带有以下资源的 cert-manager 来保护它时,HTTPS 请求失败状态就像 curl

`Immediate connect fail for 64:ff9b::2247:fd8a: Network is unreachable
* connect to 34.71.253.138 port 443 failed: Connection refused`.

我应该怎么做才能使其也适用于 HTTPS。

具有以下配置的 ClusterIssuer

apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
  name: letsencrypt-staging
  namespace: istio-system
spec:
  acme:
    # The ACME server URL
    server: https://acme-staging-v02.api.letsencrypt.org/directory
    # Email address used for ACME registration
    email: iprocureservers@iprocu.re
    # Name of a secret used to store the ACME account private key
    privateKeySecretRef:
      name: letsencrypt-staging
    solvers:
    # ACME DNS-01 provider configurations
    - dns01:
        # Google Cloud DNS
        clouddns:
          # Secret from the google service account key
          serviceAccountSecretRef:
            name: cert-manager-credentials
            key: gcp-dns-admin.json
          # The project in which to update the DNS zone
          project: iprocure-server

这样的证书配置,使证书处于Ready:True状态

apiVersion: cert-manager.io/v1alpha3
kind: Certificate
metadata:
  name: letsencrypt-staging
  namespace: istio-system
spec:
  secretName: letsencrypt-staging
  commonName: "*.iprocure.tk"
  dnsNames:
  - '*.iprocure.tk'
  issuerRef:
    name: letsencrypt-staging
    kind: ClusterIssuer

最后一个网关

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: iprocure-gateway
  namespace: default
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
    tls:
      httpsRedirect: false
  - port:
      number: 443
      name: https
      protocol: HTTPS
    hosts:
    - "*"
    tls:
      mode: SIMPLE
      credentialName: letsencrypt-staging

如果我这样做,kubectl describe certificate -n istio-system

    Name:         letsencrypt-staging
    Namespace:    istio-system
    Labels:       <none>
    Annotations:  <none>
    API Version:  cert-manager.io/v1
    Kind:         Certificate
    Metadata:
    Creation Timestamp:  2020-10-13T13:32:37Z
    Generation:          1
    Resource Version:    28030994
    Self Link:           /apis/cert-manager.io/v1/namespaces/istio-system/certificates/letsencrypt-staging
    UID:                 ad838d28-5349-4aaa-a618-cc3bfc316e6e
    Spec:
    Common Name:  *.iprocure.tk
    Dns Names:
        *.iprocure.tk
    Issuer Ref:
        Kind:       ClusterIssuer
        Name:       letsencrypt-staging-clusterissuer
    Secret Name:  letsencrypt-staging-cert-secret
    Status:
    Conditions:
        Last Transition Time:  2020-10-13T13:35:05Z
        Message:               Certificate is up to date and has not expired
        Reason:                Ready
        Status:                True
        Type:                  Ready
    Not After:               2021-01-11T12:35:05Z
    Not Before:              2020-10-13T12:35:05Z
    Renewal Time:            2020-12-12T12:35:05Z
    Revision:                1
    Events:                    <none>

运行 kubectl get certificates -o wide -n istio-system,产量

NAME                  READY   SECRET                            ISSUER                              STATUS                                          AGE
letsencrypt-staging   True    letsencrypt-staging-cert-secret   letsencrypt-staging-clusterissuer   Certificate is up to date and has not expired   17h

问题

我假设 https 不工作是因为 requirements 如果你想在旧版本中使用 cert-menager 和 istio 就必须启用它。

解决方案

正如评论中提到的@Yunus Einsteinium

Thank you for guiding me in the right direction. Using the OSS Istio, not the GKE one, is the way to go! I managed to make HTTPS work!

所以这里的解决方案是使用 OOS istio installed with istioctl 而不是旧的 istio gke 插件。