如果您要從 Apigee Hybrid 1.3 版或更舊版本升級,請先升級至 Hybrid 1.4 版,再升級至 1.5.10 版。請參閱將 Apigee Hybrid 升級至 1.4 版的操作說明。
升級至 1.5.10 版總覽。
升級 Apigee Hybrid 的程序分為下列幾節:
- 備份混合式安裝作業。
- 檢查 Kubernetes 版本,並視需要升級。
- 升級 ASM。
- 安裝 Hybrid 執行階段 1.5 版。
必要條件
- Apigee Hybrid 1.4 版。如要從舊版更新,請參閱將 Apigee Hybrid 升級至 1.4 版的操作說明。
升級至 1.5 版
- 這些操作說明會使用環境變數 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%
- (建議) 建立 1.4 版
$APIGEECTL_HOME/
目錄的備份副本。例如:tar -czvf $APIGEECTL_HOME/../apigeectl-v1.4-backup.tar.gz $APIGEECTL_HOME
- (建議) 按照「Cassandra 備份與復原」一文中的說明,備份 Cassandra 資料庫。
- 將 Kubernetes 平台升級至 Hybrid 1.5 支援的版本。 如需協助,請參閱相關平台的說明文件。
- 如果您執行的
cert-manager
版本早於 v1.2.0,請升級至 v1.2.0。-
使用下列指令檢查目前的
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
-
使用下列指令移除部署:
kubectl delete -n cert-manager deployment cert-manager cert-manager-cainjector cert-manager-webhook
-
使用下列指令將
cert-manager
升級至 1.2.0 版:kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.2.0/cert-manager.yaml
-
將 ASM 升級至 1.26版
請按照適用於您平台的 ASM 說明文件進行升級:
安裝及設定 ASM 的操作說明會因平台而異。平台可分為下列類別:
- GKE:在 Google Cloud 上執行的 Google Kubernetes Engine 叢集。
- Google Cloud 以外:在下列項目上執行的 Anthos 叢集:
- VMware 中的 Anthos 叢集 (GKE On-Prem)
- Anthos on bare metal
- AWS 中的 Anthos 叢集
- Amazon EKS
- 其他 Kubernetes 平台:在下列項目中建立及執行的相容叢集:
- AKS
- EKS
- OpenShift
GKE
如要將混合式安裝升級至 ASM 1.8.x 版,請按照下列順序操作:
- 為升級做好準備。
- 安裝新版 ASM。
- 從目前的安裝項目中,刪除舊版 ASM 的部署項目、服務和 Webhook。
- 升級閘道並設定新的 Webhook。
如要將 GKE 混合式環境升級至 ASM 1.8.x 版,請按照下列步驟操作:
- 請參閱「升級 Anthos 服務網格」一文中的需求,但暫時不要執行升級。
- 安裝新版本前,請先判斷目前的修訂版本。您需要這項資訊,才能從目前的安裝項目中刪除舊版 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}
- 建立新的
overlay.yaml
檔案,或確認現有的overlay.yaml
檔案包含下列內容:apiVersion: install.istio.io/v1alpha1 kind: IstioOperator spec: revision: asm-1264-1 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)%"}'
- 請按照 ASM 說明文件下列章節中的操作說明進行:
- 刪除變動 Webhook 和驗證 Webhook:
cd
到安裝asmcli
的目錄。- 將目前的修訂版本儲存在環境變數中,以便在指令碼中刪除 Webhook:
UPGRADE_REV="asm-1264-1"
- 建立包含下列指令的殼層指令碼:
#!/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
- 執行指令碼,刪除目前的 Webhook。
- 按照「升級閘道」一文中的步驟建立新的 Webhook,並將流量切換至新的閘道。
Google Cloud 以外
這些操作說明涵蓋下列項目的 ASM 升級作業:
- VMware 中的 Anthos 叢集 (GKE On-Prem)
- Anthos on bare metal
- AWS 中的 Anthos 叢集
- Amazon EKS
- 請參閱「升級 Anthos 服務網格」一文中的需求,但暫時不要執行升級。
- 安裝新版本前,請先判斷目前的修訂版本。您需要這項資訊,才能從目前的 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}
- 建立新的
overlay.yaml
檔案,或確認現有的overlay.yaml
檔案包含下列內容:apiVersion: install.istio.io/v1alpha1 kind: IstioOperator spec: revision: asm-1264-1 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)%"}'
- 請按照 ASM 說明文件下列章節中的操作說明進行:
- 刪除變動 Webhook 和驗證 Webhook:
cd
到安裝asmcli
的目錄。- 將目前的修訂版本儲存在環境變數中,以便在指令碼中刪除 Webhook:
UPGRADE_REV="asm-1264-1"
- 建立包含下列指令的殼層指令碼:
#!/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
- 執行指令碼,刪除目前的 Webhook。
- 按照「升級閘道」一文中的步驟建立新的 Webhook,並將流量切換至新的閘道。
AKS / EKS
在這些操作說明中,升級 Anthos 連結叢集上 Anthos 服務網格 (ASM) 版本 istio-1.26.4-asm.1 的程序,與全新安裝程序相同。
準備安裝 Anthos Service Mesh
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-linux-amd64.tar.gz
- 下載簽名檔,並使用 openssl 驗證簽名:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-linux-amd64.tar.gz.1.sig
openssl dgst -verify /dev/stdin -signature istio-1.26.4-asm.1-linux-amd64.tar.gz.1.sig istio-1.26.4-asm.1.tar.gz <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf istio-1.26.4-asm.1-linux-amd64.tar.gz
這個指令會在目前的工作目錄中建立名為
istio-1.26.4-asm.1
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd istio-1.26.4-asm.1
- 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
export PATH=$PWD/bin:$PATH
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-osx.tar.gz
- 下載簽名檔,並使用 openssl 驗證簽名:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-osx.tar.gz.1.sig
openssl dgst -sha256 -verify /dev/stdin -signature istio-1.26.4-asm.1-osx.tar.gz.1.sig istio-1.26.4-asm.1.tar.gz <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf istio-1.26.4-asm.1-osx.tar.gz
這個指令會在目前的工作目錄中建立名為
istio-1.26.4-asm.1
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd istio-1.26.4-asm.1
- 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
export PATH=$PWD/bin:$PATH
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-win.zip
- 下載簽名檔,並使用 openssl 驗證簽名:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-win.zip.1.sig
openssl dgst -verify - -signature istio-1.26.4-asm.1-win.zip.1.sig istio-1.26.4-asm.1.win.zip <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf istio-1.26.4-asm.1-win.zip
這個指令會在目前的工作目錄中建立名為
istio-1.26.4-asm.1
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests\profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd istio-1.26.4-asm.1
- 為方便起見,請將 \bin 目錄中的工具新增至 PATH:
set PATH=%CD%\bin:%PATH%
- 安裝 ASM Istio 後,請檢查
istioctl
的版本:istioctl version
- 為控制層元件建立名為 istio-system 的命名空間:
kubectl create namespace istio-system
Linux
Mac OS
Windows
設定驗證 Webhook
安裝 Anthos 服務網格時,您會在 istiod 上設定修訂版本標籤。您需要在驗證 Webhook 上設定相同的修訂版本。
- 建立名為
istiod-service.yaml
的檔案,並在當中加入下列內容:apiVersion: v1 kind: Service metadata: name: istiod namespace: istio-system labels: istio.io/rev: asm-1264-1 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: asm-1264-1 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)%"}'
- 使用
kubectl
套用驗證 webhook 設定:kubectl apply -f istiod-service.yaml
- 確認設定已套用:
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 Service Mesh
- 使用
asm-multicloud
設定檔,透過istioctl
安裝 Anthos 服務網格:istioctl install \ --set profile=asm-multicloud \ --set revision="asm-1264-1"
輸出內容應如下所示:
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-asm-1264-1-798ffb964-2ls88 1/1 Running 0 3m21s istiod-asm-1264-1-798ffb964-fnj8c 1/1 Running 1 3m21s
--set revision
引數會將修訂版本標籤新增至 istiod,格式為istio.io/rev=asm-1264-1
。自動 Sidecar 注入器 Webhook 會使用修訂版本標籤,將注入的 Sidecar 與特定 istiod 修訂版本建立關聯。如要為命名空間啟用 Sidecar 自動插入功能,您必須使用與 istiod 標籤相符的修訂版本標記命名空間。 - 確認安裝完成:
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-asm-1264-1 ClusterIP 172.200.63.220 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 3m43s
OpenShift
在這些操作說明中,升級 Anthos 連結叢集上 Anthos 服務網格 (ASM) 版本 istio-1.26.4-asm.1 的程序,與全新安裝程序相同。
準備安裝 Anthos Service Mesh
- 使用下列 OpenShift CLI (
oc
) 指令,將anyuid
安全性環境限制 (SCC) 授予 istio-system:oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-linux-amd64.tar.gz
- 下載簽名檔,並使用 openssl 驗證簽名:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-linux-amd64.tar.gz.1.sig
openssl dgst -verify /dev/stdin -signature istio-1.26.4-asm.1-linux-amd64.tar.gz.1.sig istio-1.26.4-asm.1.tar.gz <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf istio-1.26.4-asm.1-linux-amd64.tar.gz
這個指令會在目前的工作目錄中建立名為
istio-1.26.4-asm.1
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd istio-1.26.4-asm.1
- 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
export PATH=$PWD/bin:$PATH
- 使用下列 OpenShift CLI (
oc
) 指令,將anyuid
安全性環境限制 (SCC) 授予 istio-system:oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-osx.tar.gz
- 下載簽名檔,並使用 openssl 驗證簽名:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-osx.tar.gz.1.sig
openssl dgst -sha256 -verify /dev/stdin -signature istio-1.26.4-asm.1-osx.tar.gz.1.sig istio-1.26.4-asm.1.tar.gz <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf istio-1.26.4-asm.1-osx.tar.gz
這個指令會在目前的工作目錄中建立名為
istio-1.26.4-asm.1
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd istio-1.26.4-asm.1
- 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
export PATH=$PWD/bin:$PATH
- 使用下列 OpenShift CLI (
oc
) 指令,將anyuid
安全性環境限制 (SCC) 授予 istio-system:oc adm policy add-scc-to-group anyuid system:serviceaccounts:istio-system
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-win.zip
- 下載簽名檔,並使用 openssl 驗證簽名:
curl -LO https://storage.googleapis.com/gke-release/asm/istio-1.26.4-asm.1-win.zip.1.sig
openssl dgst -verify - -signature istio-1.26.4-asm.1-win.zip.1.sig istio-1.26.4-asm.1.win.zip <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf istio-1.26.4-asm.1-win.zip
這個指令會在目前的工作目錄中建立名為
istio-1.26.4-asm.1
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests\profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd istio-1.26.4-asm.1
- 為方便起見,請將 \bin 目錄中的工具新增至 PATH:
set PATH=%CD%\bin:%PATH%
- 安裝 ASM Istio 後,請檢查
istioctl
的版本:istioctl version
- 為控制層元件建立名為 istio-system 的命名空間:
kubectl create namespace istio-system
Linux
Mac OS
Windows
設定驗證 Webhook
安裝 Anthos 服務網格時,您會在 istiod 上設定修訂版本標籤。您需要在驗證 Webhook 上設定相同的修訂版本。
- 建立名為
istiod-service.yaml
的檔案,並在當中加入下列內容:apiVersion: v1 kind: Service metadata: name: istiod namespace: istio-system labels: istio.io/rev: asm-1264-1 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: asm-1264-1 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)%"}'
- 使用
kubectl
套用驗證 webhook 設定:kubectl apply -f istiod-service.yaml
- 確認設定已套用:
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 Service Mesh
- 使用
asm-multicloud
設定檔,透過istioctl
安裝 Anthos 服務網格:istioctl install \ --set profile=asm-multicloud \ --set revision=istio-1.26.4-asm.1
輸出內容應如下所示:
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-asm-1264-1-798ffb964-2ls88 1/1 Running 0 3m21s istiod-asm-1264-1-798ffb964-fnj8c 1/1 Running 1 3m21s
--set revision
引數會將修訂版本標籤新增至 istiod,格式為istio.io/rev=1.8.6-asm.1
。自動 Sidecar 注入器 Webhook 會使用修訂版本標籤,將注入的 Sidecar 與特定 istiod 修訂版本建立關聯。如要為命名空間啟用 Sidecar 自動插入功能,您必須使用與 istiod 標籤相符的修訂版本標記命名空間。 - 確認安裝完成:
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-asm-1264-1 ClusterIP 172.200.63.220 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 3m43s
安裝 Hybrid 1.5.10 執行階段
根據所用的作業系統下載發布套件:
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
- 將目前的
apigeectl/
目錄重新命名為備份目錄名稱。例如:mv $APIGEECTL_HOME/ $APIGEECTL_HOME-v1.2/
-
將下載的 gzip 檔案內容解壓縮至混合式基本目錄。例如:
tar xvzf FILENAME.tar.gz -C HYBRID_BASE_DIRECTORY
cd
至基本目錄。-
根據預設,tar 內容會展開至目錄,且目錄名稱中含有版本和平台。例如:
./apigeectl_1.5.0-d591b23_linux_64
。將該目錄重新命名為apigeectl
:mv apigeectl_1.5.0-d591b23_linux_64 apigeectl
- 在新
apigeectl/
目錄中,執行apigeectl init
、apigeectl apply
和apigeectl check-ready
:- 初始化 Hybrid 1.5.10:
apigeectl init -f OVERRIDES
.yaml
其中 OVERRIDES
.yaml
是您編輯過的overrides.yaml
檔案。 - 使用下列指令檢查是否已正確初始化:
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
apigeectl
--dry-run
旗標的語法取決於您執行的kubectl
版本。查看「kubectl
」版本:gcloud version
- 使用適用於您
kubectl
版本的指令執行模擬測試,檢查是否有錯誤:kubectl
1.17 以下版本:apigeectl apply -f OVERRIDES
.yaml
--dry-run=truekubectl
1.18 以上版本:apigeectl apply -f OVERRIDES
.yaml
--dry-run=client - 套用覆寫值。根據您的安裝方式,選取並按照實際工作環境或示範/實驗環境的操作說明進行。
生產
在正式環境中,您應個別升級每個混合式元件,並在繼續下一個元件之前,檢查升級元件的狀態。
- 套用覆寫項目來升級 Cassandra:
apigeectl apply -f OVERRIDES
.yaml
--datastore - 完成檢查:
apigeectl check-ready -f OVERRIDES
.yaml
只有在 Pod 準備就緒時,才繼續執行下一個步驟。
- 套用覆寫項目來升級遙測元件,並檢查是否完成:
apigeectl apply -f OVERRIDES
.yaml
--telemetryapigeectl check-ready -f OVERRIDES
.yaml
- 啟動 Redis 元件:
apigeectl apply -f OVERRIDES
.yaml
--redis - 套用覆寫項目,升級機構層級元件 (MART、Watcher 和 Apigee Connect),並檢查是否完成:
apigeectl apply -f OVERRIDES
.yaml
--orgapigeectl check-ready -f OVERRIDES
.yaml
- 套用覆寫內容來升級環境。你有兩種選擇:
- 逐一環境:一次對一個環境套用覆寫,並檢查完成情況。針對每個環境重複這個步驟:
apigeectl apply -f OVERRIDES
.yaml
--env ENV_NAMEapigeectl check-ready -f OVERRIDES
.yaml
其中 ENV_NAME 是要升級的環境名稱。
- 一次套用至所有環境:一次將覆寫值套用至所有環境,並檢查完成情況:
apigeectl apply -f OVERRIDES
.yaml
--all-envsapigeectl check-ready -f OVERRIDES
.yaml
- 逐一環境:一次對一個環境套用覆寫,並檢查完成情況。針對每個環境重複這個步驟:
示範/實驗
在大多數的示範或實驗環境中,您可以一次將覆寫套用至所有元件。如果您的示範/實驗環境規模龐大且複雜,或與實際執行環境非常相似,建議按照實際執行環境的升級說明操作。
apigeectl apply -f OVERRIDES
.yaml
- 查看狀態:
apigeectl check-ready -f OVERRIDES
.yaml
- 套用覆寫項目來升級 Cassandra:
- 初始化 Hybrid 1.5.10:
復原升級作業
如要復原先前的升級,請按照下列步驟操作:
- 清除混合式執行階段命名空間中已完成的工作,其中 NAMESPACE 是您在覆寫檔案中指定的命名空間 (如有指定)。否則預設命名空間為
apigee
:kubectl delete job -n NAMESPACE \ $(kubectl get job -n NAMESPACE \ -o=jsonpath='{.items[?(@.status.succeeded==1)].metadata.name}')
- 清除
apigee-system
命名空間中已完成的工作:kubectl delete job -n apigee-system \ $(kubectl get job -n apigee-system \ -o=jsonpath='{.items[?(@.status.succeeded==1)].metadata.name}')
- 變更
APIGEECTL_HOME
變數,指向包含舊版apigeectl
的目錄。例如:export APIGEECTL_HOME=PATH_TO_PREVIOUS_APIGEECTL_DIRECTORY
- 在要還原的安裝根目錄中,執行
apigeectl apply
,檢查 Pod 的狀態,刪除 Redis 元件 (混合式 1.5.0 版的新功能),然後執行apigeectl init
。請務必使用要復原版本的原始覆寫檔案:- 執行
apigeectl apply
:$APIGEECTL_HOME
/apigeectl apply -f overrides/ORIGINAL_OVERRIDES.yaml
- 檢查 pod 的狀態:
kubectl -n NAMESPACE get pods
其中 NAMESPACE 是 Apigee Hybrid 命名空間。
只有在
apigeeds
Pod 正在執行時,才能繼續下一個步驟。 -
由於 Redis 是 Hybrid 1.5 版的新元件,請執行下列指令刪除:
apigeectl_1.5.0 delete --redis -f ORIGINAL_OVERRIDES
.yaml
- 執行
apigeectl init
:$APIGEECTL_HOME
/apigeectl init -f overrides/ORIGINAL_OVERRIDES.yaml
- 執行