將 Apigee Hybrid 升級至 1.5 版

如果您要從 Apigee Hybrid 1.3 以下版本升級,必須先升級至 Hybrid 1.4 版本,再升級至 1.5.10 版本。請參閱將 Apigee Hybrid 升級至 1.4 版的操作說明。

升級至 1.5.10 版總覽。

升級 Apigee Hybrid 的程序分為以下幾個部分:

  1. 備份混合式安裝作業。
  2. 檢查 Kubernetes 版本,並視需要升級。
  3. 升級 ASM。
  4. 安裝 Hybrid 執行階段 1.5 版。

必修課程

升級至 1.5 版

  1. 這些操作說明會使用環境變數 APIGEECTL_HOME,用於您已安裝 apigeectl 的檔案系統目錄。如有需要,請將 cd 放入 apigeectl 目錄,然後使用下列指令定義變數:

    Linux

    export APIGEECTL_HOME=$PWD
    echo $APIGEECTL_HOME

    Mac OS

    export APIGEECTL_HOME=$PWD
    echo $APIGEECTL_HOME

    Windows

    set APIGEECTL_HOME=%CD%
    echo %APIGEECTL_HOME%
  2. (建議) 備份 1.4 版 $APIGEECTL_HOME/ 目錄。例如:
    tar -czvf $APIGEECTL_HOME/../apigeectl-v1.4-backup.tar.gz $APIGEECTL_HOME
  3. (建議) 按照「Cassandra 備份與復原」一文中的指示備份 Cassandra 資料庫
  4. 將 Kubernetes 平台升級至 hybrid 1.5 支援的版本。如需協助,請參閱平台的說明文件。
  5. 如果您執行的 cert-manager 版本為 1.2.0 以下,則需要升級至 1.2.0。
    1. 使用下列指令查看目前的 cert-manager 版本:

      kubectl -n cert-manager get deployment -o yaml | grep 'image:'
      

      系統會傳回類似以下的內容:

      image: quay.io/jetstack/cert-manager-controller:v1.2.0
      image: quay.io/jetstack/cert-manager-cainjector:v1.2.0
      image: quay.io/jetstack/cert-manager-webhook:v1.2.0
    2. 使用下列指令移除部署:
      kubectl delete -n cert-manager deployment cert-manager cert-manager-cainjector cert-manager-webhook
      
    3. 使用下列指令將 cert-manager 升級至 1.2.0 版:
      kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.2.0/cert-manager.yaml
      

將 ASM 升級至 版

請按照適用於您平台的 ASM 說明文件執行升級作業:

安裝及設定 ASM 的操作說明會因平台而異。平台分為下列類別:

  • GKE:在 Google Cloud 上執行的 Google Kubernetes Engine 叢集。
  • Google Cloud 以外:在下列系統上執行的 Anthos 叢集:
    • VMware 中的 Anthos 叢集 (GKE On-Prem)
    • 裸機中的 Anthos
    • AWS 中的 Anthos 叢集
    • Amazon EKS
  • 其他 Kubernetes 平台:在下列系統上建立及執行符合標準的叢集:
    • AKS
    • EKS
    • OpenShift

GKE

混合式安裝升級至 ASM 1.8.x 的程序如下:

  1. 準備升級。
  2. 安裝新版的 ASM。
  3. 從目前的已安裝項目中刪除先前 ASM 版本的部署、服務和 webhook。
  4. 升級閘道並設定新的 webhook。

如要在 GKE 上將混合式升級至 ASM 1.8.x 版,請按照下列步驟操作:

  1. 查看「升級 Anthos 服務網格」中的相關規定,但暫時不要執行升級作業。
  2. 在安裝新版本前,請先確認目前的修訂版本。您需要這項資訊,才能從目前的環境中刪除先前 ASM 版本的部署作業、服務和 webhook。請使用下列指令,將目前的 istiod 修訂版本儲存至環境變數:
    export DELETE_REV=$(kubectl get deploy -n istio-system -l app=istiod -o jsonpath={.items[].metadata.labels.'istio\.io\/rev'}'{"\n"}')
    echo ${DELETE_REV}
  3. 建立新的 overlay.yaml 檔案,或確認現有的 overlay.yaml 包含下列內容:
    apiVersion: install.istio.io/v1alpha1
    kind: IstioOperator
    spec:
      revision: 
      components:
        ingressGateways:
          - name: istio-ingressgateway
            enabled: true
            k8s:
              nodeSelector:
                # default node selector, if different or not using node selectors, change accordingly.
                cloud.google.com/gke-nodepool: apigee-runtime
              resources:
                requests:
                  cpu: 1000m
              service:
                type: LoadBalancer
                loadBalancerIP: STATIC_IP # If you do not have a reserved static IP, leave this out.
                ports:
                  - name: http-status-port
                    port: 15021
                  - name: http2
                    port: 80
                    targetPort: 8080
                  - name: https
                    port: 443
                    targetPort: 8443
      meshConfig:
        accessLogFormat:
          '{"start_time":"%START_TIME%","remote_address":"%DOWNSTREAM_DIRECT_REMOTE_ADDRESS%","user_agent":"%REQ(USER-AGENT)%","host":"%REQ(:AUTHORITY)%","request":"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%","request_time":"%DURATION%","status":"%RESPONSE_CODE%","status_details":"%RESPONSE_CODE_DETAILS%","bytes_received":"%BYTES_RECEIVED%","bytes_sent":"%BYTES_SENT%","upstream_address":"%UPSTREAM_HOST%","upstream_response_flags":"%RESPONSE_FLAGS%","upstream_response_time":"%RESPONSE_DURATION%","upstream_service_time":"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%","upstream_cluster":"%UPSTREAM_CLUSTER%","x_forwarded_for":"%REQ(X-FORWARDED-FOR)%","request_method":"%REQ(:METHOD)%","request_path":"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%","request_protocol":"%PROTOCOL%","tls_protocol":"%DOWNSTREAM_TLS_VERSION%","request_id":"%REQ(X-REQUEST-ID)%","sni_host":"%REQUESTED_SERVER_NAME%","apigee_dynamic_data":"%DYNAMIC_METADATA(envoy.lua)%"}'
  4. 請按照 ASM 說明文件中以下各節的操作說明進行:
    1. 下載 asmcli
    2. 授予叢集管理員權限
    3. 驗證專案和叢集
    4. 升級至含選用功能的方案。在開始「升級網關」部分前先停下
  5. 刪除變異 Webhook 和驗證 Webhook:
    1. cd 至安裝 asmcli 的目錄。
    2. 將目前的新修訂版本儲存在環境變數中,以便在刪除 webhook 時使用:
      UPGRADE_REV=""
    3. 建立包含下列指令的指令稿:
      #!/bin/bash
      
      set -ex
      
      PROJECT_ID="YOUR_PROJECT_ID"
      CLUSTER_NAME="YOUR_CLUSTER_NAME"
      CLUSTER_LOCATION="YOUR_CLUSTER_LOCATION"
      
      kubectl label namespace istio-system istio.io/rev=${UPGRADE_REV} istio-injection- --overwrite
      kubectl rollout restart deployment -n istio-system
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAYistio-ingressgateway
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAY/istio-ingressgateway-connectors
      
      if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then
        kubectl apply -f out/asm/istio/istiod-service.yaml
        kubectl delete deploy -l app=istio-ingressgateway,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete deploy -l app=istio-ingressgateway-connectors,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete ValidatingWebhookConfiguration -l app=istiod,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete MutatingWebhookConfiguration -l app=sidecar-injector,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete Service,Deployment,HorizontalPodAutoscaler,PodDisruptionBudget istiod-${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete IstioOperator installed-state-${DELETE_REV} -n istio-system --ignore-not-found=true
      fi
      
    4. 執行指令碼,刪除目前的 webhook。
  6. 請按照「升級閘道」中的步驟建立新的 webhook,並將流量切換至新的閘道。

Google Cloud 以外

這些操作說明涵蓋以下項目的 ASM 升級作業:

  • VMware 中的 Anthos 叢集 (GKE On-Prem)
  • 裸機中的 Anthos
  • AWS 中的 Anthos 叢集
  • Amazon EKS
  1. 查看「升級 Anthos 服務網格」中的相關規定,但暫時不要執行升級作業。
  2. 在安裝新版本前,請先確認目前的修訂版本。您需要這項資訊才能從目前的 ASM 安裝項目中刪除驗證 webhook變異 webhook。請使用下列指令,將目前的 istiod 修訂版本儲存至環境變數:
    export DELETE_REV=$(kubectl get deploy -n istio-system -l app=istiod -o jsonpath={.items[].metadata.labels.'istio\.io\/rev'}'{"\n"}')
    echo ${DELETE_REV}
  3. 建立新的 overlay.yaml 檔案,或確認現有的 overlay.yaml 包含下列內容:
    apiVersion: install.istio.io/v1alpha1
    kind: IstioOperator
    spec:
      revision: 
      components:
        ingressGateways:
          - name: istio-ingressgateway
            enabled: true
            k8s:
              nodeSelector:
                # default node selector, if different or not using node selectors, change accordingly.
                cloud.google.com/gke-nodepool: apigee-runtime
              resources:
                requests:
                  cpu: 1000m
              service:
                type: LoadBalancer
                loadBalancerIP: STATIC_IP # If you do not have a reserved static IP, leave this out.
                ports:
                  - name: http-status-port
                    port: 15021
                  - name: http2
                    port: 80
                    targetPort: 8080
                  - name: https
                    port: 443
                    targetPort: 8443
      values:
        gateways:
          istio-ingressgateway:
            runAsRoot: true
    
      meshConfig:
        accessLogFormat:
          '{"start_time":"%START_TIME%","remote_address":"%DOWNSTREAM_DIRECT_REMOTE_ADDRESS%","user_agent":"%REQ(USER-AGENT)%","host":"%REQ(:AUTHORITY)%","request":"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%","request_time":"%DURATION%","status":"%RESPONSE_CODE%","status_details":"%RESPONSE_CODE_DETAILS%","bytes_received":"%BYTES_RECEIVED%","bytes_sent":"%BYTES_SENT%","upstream_address":"%UPSTREAM_HOST%","upstream_response_flags":"%RESPONSE_FLAGS%","upstream_response_time":"%RESPONSE_DURATION%","upstream_service_time":"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%","upstream_cluster":"%UPSTREAM_CLUSTER%","x_forwarded_for":"%REQ(X-FORWARDED-FOR)%","request_method":"%REQ(:METHOD)%","request_path":"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%","request_protocol":"%PROTOCOL%","tls_protocol":"%DOWNSTREAM_TLS_VERSION%","request_id":"%REQ(X-REQUEST-ID)%","sni_host":"%REQUESTED_SERVER_NAME%","apigee_dynamic_data":"%DYNAMIC_METADATA(envoy.lua)%"}'
  4. 請按照 ASM 說明文件中以下各節的操作說明進行:
    1. 下載 asmcli
    2. 授予叢集管理員權限
    3. 驗證專案和叢集
    4. 升級至含選用功能的方案。在開始「升級網關」部分前先停下
  5. 刪除變異 Webhook 和驗證 Webhook:
    1. cd 至安裝 asmcli 的目錄。
    2. 將目前的新修訂版本儲存在環境變數中,以便在刪除 webhook 時使用:
      UPGRADE_REV=""
    3. 建立包含下列指令的指令稿:
      #!/bin/bash
      
      set -ex
      
      PROJECT_ID="YOUR_PROJECT_ID"
      CLUSTER_NAME="YOUR_CLUSTER_NAME"
      CLUSTER_LOCATION="YOUR_CLUSTER_LOCATION"
      
      
      gcloud config configurations activate ${PROJECT_ID}
      gcloud container clusters get-credentials ${CLUSTER_NAME} --region ${CLUSTER_LOCATION} --project ${PROJECT_ID}
      
      
      kubectl label namespace istio-system istio.io/rev=${UPGRADE_REV} istio-injection- --overwrite
      kubectl rollout restart deployment -n istio-system
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAYistio-ingressgateway
      kubectl apply -n istio-system -f PATH_TO_INGRESSGATEWAY/istio-ingressgateway-connectors
      
      if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then
        kubectl apply -f out/asm/istio/istiod-service.yaml
        kubectl delete deploy -l app=istio-ingressgateway,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete deploy -l app=istio-ingressgateway-connectors,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete ValidatingWebhookConfiguration -l app=istiod,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete MutatingWebhookConfiguration -l app=sidecar-injector,istio.io/rev=${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete Service,Deployment,HorizontalPodAutoscaler,PodDisruptionBudget istiod-${DELETE_REV} -n istio-system --ignore-not-found=true
        kubectl delete IstioOperator installed-state-${DELETE_REV} -n istio-system --ignore-not-found=true
      fi
      
    4. 執行指令碼,刪除目前的 webhook。
  6. 請按照「升級閘道」中的步驟建立新的 webhook,並將流量切換至新的閘道。

AKS / EKS

在這些操作說明中,在 Anthos 已連結叢集中升級 Anthos 服務網格 (ASM) 版本的程序,與執行全新安裝程序相同。

準備安裝 Anthos 服務網格

    Linux

  1. 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
    curl -LO https://storage.googleapis.com/gke-release/asm/-linux-amd64.tar.gz
  2. 下載簽章檔案,然後使用 openssl 驗證簽章:
    curl -LO https://storage.googleapis.com/gke-release/asm/-linux-amd64.tar.gz.1.sig
    openssl dgst -verify /dev/stdin -signature -linux-amd64.tar.gz.1.sig .tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  3. 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
    tar xzf -linux-amd64.tar.gz

    這個指令會在目前工作目錄中建立名為 的安裝目錄,其中包含:

    • samples 目錄中的範例應用程式。
    • 用來安裝 Anthos 服務網格的 istioctl 指令列工具位於 bin 目錄中。
    • Anthos 服務網格設定檔位於 manifests/profiles 目錄中。
  4. 請確認您位於 Anthos 服務網格安裝的根目錄中:
    cd 
  5. 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
    export PATH=$PWD/bin:$PATH
  6. Mac OS

  7. 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
    curl -LO https://storage.googleapis.com/gke-release/asm/-osx.tar.gz
  8. 下載簽章檔案,然後使用 openssl 驗證簽章:
    curl -LO https://storage.googleapis.com/gke-release/asm/-osx.tar.gz.1.sig
    openssl dgst -sha256 -verify /dev/stdin -signature -osx.tar.gz.1.sig .tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  9. 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
    tar xzf -osx.tar.gz

    這個指令會在目前工作目錄中建立名為 的安裝目錄,其中包含:

    • samples 目錄中的範例應用程式。
    • 用來安裝 Anthos 服務網格的 istioctl 指令列工具位於 bin 目錄中。
    • Anthos 服務網格設定檔位於 manifests/profiles 目錄中。
  10. 請確認您位於 Anthos 服務網格安裝的根目錄中:
    cd 
  11. 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
    export PATH=$PWD/bin:$PATH
  12. Windows

  13. 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
    curl -LO https://storage.googleapis.com/gke-release/asm/-win.zip
  14. 下載簽章檔案,然後使用 openssl 驗證簽章:
    curl -LO https://storage.googleapis.com/gke-release/asm/-win.zip.1.sig
    openssl dgst -verify - -signature -win.zip.1.sig .win.zip <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  15. 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
    tar xzf -win.zip

    這個指令會在目前工作目錄中建立名為 的安裝目錄,其中包含:

    • samples 目錄中的範例應用程式。
    • 用來安裝 Anthos 服務網格的 istioctl 指令列工具位於 bin 目錄中。
    • Anthos 服務網格設定檔位於 manifests\profiles 目錄中。
  16. 請確認您位於 Anthos 服務網格安裝的根目錄中:
    cd 
  17. 為方便起見,請將 \bin 目錄中的工具新增至 PATH:
    set PATH=%CD%\bin:%PATH%
  18. 安裝 ASM Istio 後,請檢查 istioctl 的版本:
    istioctl version
  19. 為控制平面元件建立名為 istio-system 的命名空間:
    kubectl create namespace istio-system

設定驗證 Webhook

安裝 Anthos 服務網格時,您會在 istiod 上設定修訂版本標籤。您需要在驗證 webhook 上設定相同的修訂版本。

  1. 建立名為 istiod-service.yaml 的檔案,並在其中加入下列內容:
    apiVersion: v1
    kind: Service
    metadata:
      name: istiod
      namespace: istio-system
      labels:
        istio.io/rev: 
        app: istiod
        istio: pilot
        release: istio
    spec:
      ports:
        - port: 15010
          name: grpc-xds # plaintext
          protocol: TCP
        - port: 15012
          name: https-dns # mTLS with k8s-signed cert
          protocol: TCP
        - port: 443
          name: https-webhook # validation and injection
          targetPort: 15017
          protocol: TCP
        - port: 15014
          name: http-monitoring # prometheus stats
          protocol: TCP
      selector:
        app: istiod
        istio.io/rev: 
      meshConfig:
        accessLogFormat:
          '{"start_time":"%START_TIME%","remote_address":"%DOWNSTREAM_DIRECT_REMOTE_ADDRESS%","user_agent":"%REQ(USER-AGENT)%","host":"%REQ(:AUTHORITY)%","request":"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%","request_time":"%DURATION%","status":"%RESPONSE_CODE%","status_details":"%RESPONSE_CODE_DETAILS%","bytes_received":"%BYTES_RECEIVED%","bytes_sent":"%BYTES_SENT%","upstream_address":"%UPSTREAM_HOST%","upstream_response_flags":"%RESPONSE_FLAGS%","upstream_response_time":"%RESPONSE_DURATION%","upstream_service_time":"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%","upstream_cluster":"%UPSTREAM_CLUSTER%","x_forwarded_for":"%REQ(X-FORWARDED-FOR)%","request_method":"%REQ(:METHOD)%","request_path":"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%","request_protocol":"%PROTOCOL%","tls_protocol":"%DOWNSTREAM_TLS_VERSION%","request_id":"%REQ(X-REQUEST-ID)%","sni_host":"%REQUESTED_SERVER_NAME%","apigee_dynamic_data":"%DYNAMIC_METADATA(envoy.lua)%"}'
  2. 使用 kubectl 套用驗證 Webhook 設定:
    kubectl apply -f istiod-service.yaml
  3. 驗證是否已套用設定:
    kubectl get svc -n istio-system

    回應內容應如下所示:

    NAME     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                                 AGE
    istiod   ClusterIP   172.200.18.133   <none>        15010/TCP,15012/TCP,443/TCP,15014/TCP   22s

安裝 Anthos 服務網格

  1. 使用 asm-multicloud 設定檔,透過 istioctl 安裝 Anthos 服務網格:
    istioctl install \
        --set profile=asm-multicloud \
        --set revision=""

    輸出內容應如下所示:

    kubectl get pods -n istio-system
    NAME                                   READY   STATUS    RESTARTS   AGE
    istio-ingressgateway-88b6fd976-flgp2   1/1     Running   0          3m13s
    istio-ingressgateway-88b6fd976-p5dl9   1/1     Running   0          2m57s
    istiod--798ffb964-2ls88       1/1     Running   0          3m21s
    istiod--798ffb964-fnj8c       1/1     Running   1          3m21s

    --set revision 引數會將以 istio.io/rev= 格式編寫的修訂版本標籤新增至 istiod。自動附加元件注入器 webhook 會使用修訂版本標籤,將注入的附加元件與特定 istiod 修訂版本建立關聯。如要為命名空間啟用自動補充插入功能,您必須使用與 istiod 上的標籤相符的修訂版本標記命名空間。

  2. 確認安裝作業已完成:
    kubectl get svc -n istio-system

    輸出內容應如下所示:

    NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)                                                                      AGE
    istio-ingressgateway   LoadBalancer   172.200.48.52    34.74.177.168   15021:30479/TCP,80:30030/TCP,443:32200/TCP,15012:32297/TCP,15443:30244/TCP   3m35s
    istiod                 ClusterIP      172.200.18.133   <none>          15010/TCP,15012/TCP,443/TCP,15014/TCP                                        4m46s
    istiod-       ClusterIP      172.200.63.220   <none>          15010/TCP,15012/TCP,443/TCP,15014/TCP                                        3m43s

OpenShift

在這些操作說明中,在 Anthos 已連結叢集中升級 Anthos 服務網格 (ASM) 版本的程序,與執行全新安裝程序相同。

準備安裝 Anthos 服務網格

    Linux

  1. 使用下列 OpenShift CLI (oc) 指令,將 anyuid 安全性內容限制 (SCC) 授予 istio-system:
    oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
  2. 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
    curl -LO https://storage.googleapis.com/gke-release/asm/-linux-amd64.tar.gz
  3. 下載簽章檔案,然後使用 openssl 驗證簽章:
    curl -LO https://storage.googleapis.com/gke-release/asm/-linux-amd64.tar.gz.1.sig
    openssl dgst -verify /dev/stdin -signature -linux-amd64.tar.gz.1.sig .tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  4. 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
    tar xzf -linux-amd64.tar.gz

    這個指令會在目前工作目錄中建立名為 的安裝目錄,其中包含:

    • samples 目錄中的範例應用程式。
    • 用來安裝 Anthos 服務網格的 istioctl 指令列工具位於 bin 目錄中。
    • Anthos 服務網格設定檔位於 manifests/profiles 目錄中。
  5. 請確認您位於 Anthos 服務網格安裝的根目錄中:
    cd 
  6. 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
    export PATH=$PWD/bin:$PATH
  7. Mac OS

  8. 使用下列 OpenShift CLI (oc) 指令,將 anyuid 安全性內容限制 (SCC) 授予 istio-system:
    oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
  9. 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
    curl -LO https://storage.googleapis.com/gke-release/asm/-osx.tar.gz
  10. 下載簽章檔案,然後使用 openssl 驗證簽章:
    curl -LO https://storage.googleapis.com/gke-release/asm/-osx.tar.gz.1.sig
    openssl dgst -sha256 -verify /dev/stdin -signature -osx.tar.gz.1.sig .tar.gz <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  11. 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
    tar xzf -osx.tar.gz

    這個指令會在目前工作目錄中建立名為 的安裝目錄,其中包含:

    • samples 目錄中的範例應用程式。
    • 用來安裝 Anthos 服務網格的 istioctl 指令列工具位於 bin 目錄中。
    • Anthos 服務網格設定檔位於 manifests/profiles 目錄中。
  12. 請確認您位於 Anthos 服務網格安裝的根目錄中:
    cd 
  13. 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
    export PATH=$PWD/bin:$PATH
  14. Windows

  15. 使用下列 OpenShift CLI (oc) 指令,將 anyuid 安全性內容限制 (SCC) 授予 istio-system:
    oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
  16. 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
    curl -LO https://storage.googleapis.com/gke-release/asm/-win.zip
  17. 下載簽章檔案,然後使用 openssl 驗證簽章:
    curl -LO https://storage.googleapis.com/gke-release/asm/-win.zip.1.sig
    openssl dgst -verify - -signature -win.zip.1.sig .win.zip <<'EOF'
    -----BEGIN PUBLIC KEY-----
    MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ
    wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw==
    -----END PUBLIC KEY-----
    EOF
  18. 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
    tar xzf -win.zip

    這個指令會在目前工作目錄中建立名為 的安裝目錄,其中包含:

    • samples 目錄中的範例應用程式。
    • 用來安裝 Anthos 服務網格的 istioctl 指令列工具位於 bin 目錄中。
    • Anthos 服務網格設定檔位於 manifests\profiles 目錄中。
  19. 請確認您位於 Anthos 服務網格安裝的根目錄中:
    cd 
  20. 為方便起見,請將 \bin 目錄中的工具新增至 PATH:
    set PATH=%CD%\bin:%PATH%
  21. 安裝 ASM Istio 後,請檢查 istioctl 的版本:
    istioctl version
  22. 為控制平面元件建立名為 istio-system 的命名空間:
    kubectl create namespace istio-system

設定驗證 Webhook

安裝 Anthos 服務網格時,您會在 istiod 上設定修訂版本標籤。您需要在驗證 webhook 上設定相同的修訂版本。

  1. 建立名為 istiod-service.yaml 的檔案,並在其中加入下列內容:
    apiVersion: v1
    kind: Service
    metadata:
      name: istiod
      namespace: istio-system
      labels:
        istio.io/rev: 
        app: istiod
        istio: pilot
        release: istio
    spec:
      ports:
        - port: 15010
          name: grpc-xds # plaintext
          protocol: TCP
        - port: 15012
          name: https-dns # mTLS with k8s-signed cert
          protocol: TCP
        - port: 443
          name: https-webhook # validation and injection
          targetPort: 15017
          protocol: TCP
        - port: 15014
          name: http-monitoring # prometheus stats
          protocol: TCP
      selector:
        app: istiod
        istio.io/rev: 
      meshConfig:
        accessLogFormat:
          '{"start_time":"%START_TIME%","remote_address":"%DOWNSTREAM_DIRECT_REMOTE_ADDRESS%","user_agent":"%REQ(USER-AGENT)%","host":"%REQ(:AUTHORITY)%","request":"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%","request_time":"%DURATION%","status":"%RESPONSE_CODE%","status_details":"%RESPONSE_CODE_DETAILS%","bytes_received":"%BYTES_RECEIVED%","bytes_sent":"%BYTES_SENT%","upstream_address":"%UPSTREAM_HOST%","upstream_response_flags":"%RESPONSE_FLAGS%","upstream_response_time":"%RESPONSE_DURATION%","upstream_service_time":"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%","upstream_cluster":"%UPSTREAM_CLUSTER%","x_forwarded_for":"%REQ(X-FORWARDED-FOR)%","request_method":"%REQ(:METHOD)%","request_path":"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%","request_protocol":"%PROTOCOL%","tls_protocol":"%DOWNSTREAM_TLS_VERSION%","request_id":"%REQ(X-REQUEST-ID)%","sni_host":"%REQUESTED_SERVER_NAME%","apigee_dynamic_data":"%DYNAMIC_METADATA(envoy.lua)%"}'
  2. 使用 kubectl 套用驗證 Webhook 設定:
    kubectl apply -f istiod-service.yaml
  3. 驗證是否已套用設定:
    kubectl get svc -n istio-system

    回應內容應如下所示:

    NAME     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                                 AGE
    istiod   ClusterIP   172.200.18.133   <none>        15010/TCP,15012/TCP,443/TCP,15014/TCP   22s

安裝 Anthos 服務網格

  1. 使用 asm-multicloud 設定檔,透過 istioctl 安裝 Anthos 服務網格:
    istioctl install \
        --set profile=asm-multicloud \
        --set revision=

    輸出內容應如下所示:

    kubectl get pods -n istio-system
    NAME                                   READY   STATUS    RESTARTS   AGE
    istio-ingressgateway-88b6fd976-flgp2   1/1     Running   0          3m13s
    istio-ingressgateway-88b6fd976-p5dl9   1/1     Running   0          2m57s
    istiod--798ffb964-2ls88       1/1     Running   0          3m21s
    istiod--798ffb964-fnj8c       1/1     Running   1          3m21s

    --set revision 引數會將以 istio.io/rev=1.8.6-asm.1 格式編寫的修訂版本標籤新增至 istiod。自動附加元件注入器 webhook 會使用修訂版本標籤,將注入的附加元件與特定 istiod 修訂版本建立關聯。如要為命名空間啟用自動補充插入功能,您必須使用與 istiod 上的標籤相符的修訂版本標記命名空間。

  2. 確認安裝作業已完成:
    kubectl get svc -n istio-system

    輸出內容應如下所示:

    NAME                   TYPE           CLUSTER-IP       EXTERNAL-IP     PORT(S)                                                                      AGE
    istio-ingressgateway   LoadBalancer   172.200.48.52    34.74.177.168   15021:30479/TCP,80:30030/TCP,443:32200/TCP,15012:32297/TCP,15443:30244/TCP   3m35s
    istiod                 ClusterIP      172.200.18.133   <none>          15010/TCP,15012/TCP,443/TCP,15014/TCP                                        4m46s
    istiod-       ClusterIP      172.200.63.220   <none>          15010/TCP,15012/TCP,443/TCP,15014/TCP                                        3m43s

安裝 Hybrid 1.5.10 執行階段

  1. 下載適用於您作業系統的版本套件:

    Mac 64 位元:

    curl -LO \
        https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/1.5.10/apigeectl_mac_64.tar.gz

    Linux 64 位元:

    curl -LO \
        https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/1.5.10/apigeectl_linux_64.tar.gz

    Mac 32 位元:

    curl -LO \
        https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/1.5.10/apigeectl_mac_32.tar.gz

    Linux 32 位元:

    curl -LO \
        https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/1.5.10/apigeectl_linux_32.tar.gz
  2. 將目前的 apigeectl/ 目錄重新命名為備份目錄名稱。例如:
    mv $APIGEECTL_HOME/ $APIGEECTL_HOME-v1.2/ 
  3. 將下載的 gzip 檔案內容解壓縮至混合式基礎目錄。例如:

    tar xvzf FILENAME.tar.gz -C HYBRID_BASE_DIRECTORY
  4. cd 至基礎目錄。
  5. 根據預設,tar 內容會解壓縮為名稱中含有版本和平台的目錄。例如:./apigeectl_1.5.0-d591b23_linux_64。將該目錄重新命名為 apigeectl

    mv apigeectl_1.5.0-d591b23_linux_64 apigeectl
  6. apigeectl/ 目錄中,執行 apigeectl initapigeectl applyapigeectl check-ready
    1. 初始化 hybrid 1.5.10:
      apigeectl init -f OVERRIDES.yaml

      其中 OVERRIDES.yaml 是您編輯過的 overrides.yaml 檔案。

    2. 使用下列指令檢查是否已正確初始化:
      apigeectl check-ready -f OVERRIDES.yaml
      kubectl describe apigeeds -n apigee

      輸出內容應如下所示:

      Status:
        Cassandra Data Replication:
        Cassandra Pod Ips:
          10.8.2.204
        Cassandra Ready Replicas:  1
        Components:
          Cassandra:
            Last Successfully Released Version:
              Revision:  v1-f8aa9a82b9f69613
              Version:   v1
            Replicas:
              Available:  1
              Ready:      1
              Total:      1
              Updated:    1
            State:        running
        Scaling:
          In Progress:         false
          Operation:
          Requested Replicas:  0
        State:                 running
      
    3. apigeectl --dry-run 標記的語法會因您執行的 kubectl 版本而異。查看 kubectl 的版本:
      gcloud version
    4. 使用適合您 kubectl 版本的指令進行模擬測試,檢查是否有錯誤:

      kubectl 1.17 以下版本:

      apigeectl apply -f OVERRIDES.yaml --dry-run=true

      kubectl 1.18 以上版本:

      apigeectl apply -f OVERRIDES.yaml --dry-run=client
    5. 套用覆寫值。請根據安裝方式,選取並遵循實際工作環境或示範/實驗環境的操作說明。

      生產

      在實際環境中,您應個別升級每個混合型元件,並在繼續升級其他元件前,先檢查已升級元件的狀態。

      1. 套用覆寫值來升級 Cassandra:
        apigeectl apply -f OVERRIDES.yaml --datastore
      2. 檢查完成情況:
        apigeectl check-ready -f OVERRIDES.yaml

        只有在 Pod 就緒時,才繼續執行下一個步驟。

      3. 套用覆寫值來升級遙測元件,並檢查完成情況:
        apigeectl apply -f OVERRIDES.yaml --telemetry
        apigeectl check-ready -f OVERRIDES.yaml
      4. 啟動 Redis 元件:
        apigeectl apply -f OVERRIDES.yaml --redis
      5. 套用覆寫值來升級機構層級元件 (MART、Watcher 和 Apigee Connect),並檢查完成情況:
        apigeectl apply -f OVERRIDES.yaml --org
        apigeectl check-ready -f OVERRIDES.yaml
      6. 套用覆寫值來升級環境。您有兩種選擇:
        • 逐一環境:一次將覆寫值套用至一個環境,並檢查是否完成。針對每個環境重複執行這個步驟:
          apigeectl apply -f OVERRIDES.yaml --env ENV_NAME
          apigeectl check-ready -f OVERRIDES.yaml

          其中 ENV_NAME 是您要升級的環境名稱。

        • 一次套用至所有環境:一次將覆寫值套用至所有環境,並檢查完成情況:
          apigeectl apply -f OVERRIDES.yaml --all-envs
          apigeectl check-ready -f OVERRIDES.yaml

      示範/實驗

      在大多數的示範或實驗環境中,您可以一次將覆寫值套用至所有元件。如果您的示範/實驗環境龐大且複雜,或與實際執行環境相似,建議您參考升級實際執行環境的操作說明

      1. apigeectl apply -f OVERRIDES.yaml
      2. 查看狀態:
        apigeectl check-ready -f OVERRIDES.yaml

復原升級

如要還原先前的升級,請按照下列步驟操作:

  1. 清理混合式執行階段命名空間的已完成工作,其中 NAMESPACE 是覆寫檔案中指定的命名空間 (如果您已指定命名空間)。如未指定,預設命名空間為 apigee
    kubectl delete job -n NAMESPACE \
      $(kubectl get job -n NAMESPACE \
      -o=jsonpath='{.items[?(@.status.succeeded==1)].metadata.name}')
  2. 清理 apigee-system 命名空間的已完成工作:
    kubectl delete job -n apigee-system \
      $(kubectl get job -n apigee-system \
      -o=jsonpath='{.items[?(@.status.succeeded==1)].metadata.name}')
  3. 變更 APIGEECTL_HOME 變數,讓其指向包含舊版 apigeectl 的目錄。例如:
    export APIGEECTL_HOME=PATH_TO_PREVIOUS_APIGEECTL_DIRECTORY
  4. 在要回溯至的根目錄中執行 apigeectl apply,檢查 Pod 狀態、刪除 Redis 元件 (hybrid v1.5.0 的新功能),然後執行 apigeectl init。請務必使用原始覆寫檔案,以便還原至所需版本:
    • 執行 apigeectl apply
      $APIGEECTL_HOME/apigeectl apply -f overrides/ORIGINAL_OVERRIDES.yaml
    • 請檢查這些 pod 的狀態:
      kubectl -n NAMESPACE get pods

      其中 NAMESPACE 是 Apigee 混合式命名空間。

      只有在 apigeeds 執行時,才能繼續執行下一個步驟。

    • 由於 Redis 是混合式 1.5 版的新元件,請執行下列指令將其刪除:

      apigeectl_1.5.0 delete --redis -f ORIGINAL_OVERRIDES.yaml
    • 執行 apigeectl init
      $APIGEECTL_HOME/apigeectl init -f overrides/ORIGINAL_OVERRIDES.yaml