Istio Gateway không thể kết nối qua HTTPS

Oct 13 2020

Các triển khai trong một cụm GKE với Istio đang hoạt động chính xác thông qua HTTP. Nhưng khi tôi cố gắng bảo mật nó bằng trình quản lý cert với các tài nguyên sau, yêu cầu HTTPS không thành công ở trạng thái như vậy, v.v.

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

Tôi nên làm gì để nó hoạt động tốt với HTTPS.

ClusterIssuer với cấu hình sau

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: [email protected]
    # 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

Cấu hình chứng chỉ như vậy, tạo chứng chỉ ở trạng thái Sẵn sàng: Đúng

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

Và cuối cùng là một Gateway

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

Nếu tôi làm, 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>

Đang chạy kubectl get certificates -o wide -n istio-system, sản lượng

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

Trả lời

1 Jakub Oct 19 2020 at 15:47

Vấn đề

Tôi giả sử rằng https không hoạt động do các yêu cầu phải được bật nếu bạn muốn sử dụng cert-menager với istio trong các phiên bản cũ hơn.

Giải pháp

Như @Yunus Einsteinium đã đề cập trong các bình luận

Cảm ơn bạn đã hướng dẫn tôi đi đúng hướng. Sử dụng OSS Istio, không phải GKE, là cách tốt nhất! Tôi đã cố gắng làm cho HTTPS hoạt động!

Vì vậy, giải pháp ở đây là sử dụng istio OOS được cài đặt với istioctl thay vì addon istio gke cũ hơn.