次要版本升級 (例如從 1.6 升級至 1.7) 和修補程式版本升級 (例如從 1.7.0 升級至 1.7.6) 的程序相同。
如果您要從 Apigee hybrid 1.5 以下版本升級,請先升級至 hybrid 1.6 版,再升級至 1.7.6 版。請參閱將 Apigee Hybrid 升級至 1.6 版的操作說明。
升級至 1.7.6 版總覽。
升級 Apigee Hybrid 的程序分為以下幾個部分:
必修課程
這些升級操作說明假設您已安裝 Apigee hybrid 1.6.x 版本或 1.7.x 版本的舊版修補程式,且想要將其升級至 1.7.6 版本。如果您要從舊版更新,請參閱將 Apigee Hybrid 升級至 1.6 版的操作說明。
準備升級至 1.7 版
備份混合式安裝作業
- 這些操作說明會使用環境變數
$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.6 版
$APIGEECTL_HOME/
目錄。例如:tar -czvf $APIGEECTL_HOME/../apigeectl-v1.6-backup.tar.gz $APIGEECTL_HOME
- (建議) 按照「Cassandra 備份和復原」一文中的指示備份 Cassandra 資料庫
升級 Kubernetes 版本
將 Kubernetes 平台升級至 hybrid 1.7 支援的版本。 如需協助,請參閱平台的說明文件。
將 Cloud Trace 代理人角色新增至 apigee-runtime
服務帳戶
選用步驟:如果您打算使用 Cloud Trace,請確認您的 apigee-runtime
服務帳戶具有 Cloud Trace 代理者 (roles/cloudtrace.agent
) Google 角色。您可以前往 Cloud 控制台 > IAM 與管理員 > 服務帳戶 UI 或使用下列指令:
- 使用下列指令,取得
apigee-runtime
服務帳戶的電子郵件地址:gcloud iam service-accounts list --filter "apigee-runtime"
如果符合模式
apigee-runtime@$ORG_NAME.iam.gserviceaccount.com
,您可以在下一個步驟中使用該模式。 - 將 Cloud Trace 代理人角色指派給服務帳戶:
gcloud projects add-iam-policy-binding $PROJECT_ID \ --member="serviceAccount:apigee-runtime@$PROJECT_ID.iam.gserviceaccount.com" \ --role="roles/cloudtrace.agent"
其中:$PROJECT_ID 是安裝 Apigee hybrid 的 Google Cloud 專案名稱。
在覆寫值中取代 metrics:stackdriverExporter
屬性。
自 Hybrid 1.7 版起,metrics:stackdriverExporter
已替換為 metrics:appStackdriverExporter
和 metrics:proxyStackdriverExporter
。請將這些屬性替換為等效的屬性。例如,請將下列內容取代為:
metrics: ... ... stackdriverExporter: resources: limits: cpu: 500m memory: 1Gi requests: cpu: 128m memory: 512Mi
使用:
metrics: ... ... appStackdriverExporter: resources: limits: cpu: 500m memory: 1Gi requests: cpu: 128m memory: 512Mi proxyStackdriverExporter: resources: limits: cpu: 500m memory: 1Gi requests: cpu: 128m memory: 512Mi
請參閱設定屬性參考資料:指標
安裝 Hybrid 1.7.6 執行階段
-
使用下列指令,將最新版本號碼儲存在變數中:
Linux
export VERSION=$(curl -s \ https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/current-version.txt?ignoreCache=1)
Mac OS
export VERSION=$(curl -s \ https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/current-version.txt)
Windows
for /f "tokens=*" %a in ('curl -s ^ https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/current-version.txt') ^ do set VERSION=%a
-
使用下列指令,檢查變數是否已填入版本號碼。如果您想使用其他版本,可以改為將該版本儲存在環境變數中。
echo $VERSION
1.7.6
- 請確認您位於混合式基礎目錄 (
apigeectl
可執行檔所在目錄的父目錄):cd $APIGEECTL_HOME/..
-
請使用下列指令,下載適用於您作業系統的版本套件。請務必在下表中選取您的平台:
Linux
Linux 64 位元:
curl -LO \ https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/$VERSION/apigeectl_linux_64.tar.gz
Mac OS
Mac 64 位元:
curl -LO \ https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/$VERSION/apigeectl_mac_64.tar.gz
Windows
Windows 64 位元:
curl -LO ^ https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/%VERSION%/apigeectl_windows_64.zip
- 將目前的
apigeectl/
目錄重新命名為備份目錄名稱。例如:Linux
mv $APIGEECTL_HOME/ $APIGEECTL_HOME-v1.6/
Mac OS
mv $APIGEECTL_HOME/ $APIGEECTL_HOME-v1.6/
Windows
rename %APIGEECTL_HOME% %APIGEECTL_HOME%-v1.6
-
將下載的 gzip 檔案內容解壓縮至混合式基礎目錄。混合型基礎目錄是重新命名的
apigeectl-v1.6
目錄所在目錄:Linux
tar xvzf filename.tar.gz -C ./
Mac OS
tar xvzf filename.tar.gz -C ./
Windows
tar xvzf filename.zip -C ./
-
根據預設,tar 內容會解壓縮為名稱中含有版本和平台的目錄。例如:
./apigeectl_1.7.6-d591b23_linux_64
。使用下列指令將該目錄重新命名為apigeectl
:Linux
mv directory-name-linux apigeectl
Mac OS
mv directory-name-mac apigeectl
Windows
rename directory-name-windows apigeectl
-
切換至
apigeectl
目錄:cd ./apigeectl
apigeectl
可執行檔位於這個目錄中。 - 這些操作說明會使用環境變數
$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%
- 使用
version
指令驗證apigeectl
的版本:./apigeectl version
Version: 1.7.6
- 移至
hybrid-base-directory/hybrid-files
目錄。hybrid-files
目錄是設定檔的所在位置,例如覆寫檔案、憑證和服務帳戶。例如:cd $APIGEECTL_HOME/../hybrid-files
- 使用下列指令,確認
kubectl
已設為正確的內容。目前的內容應設為您要升級 Apigee Hybrid 的叢集。kubectl config get-contexts | grep \*
- 在
hybrid-files
目錄中:-
將下列符號連結更新為
$APIGEECTL_HOME
。這些連結可讓您從hybrid-files
目錄內執行新安裝的apigeectl
指令:ln -nfs
$APIGEECTL_HOME
/tools toolsln -nfs
$APIGEECTL_HOME
/config configln -nfs
$APIGEECTL_HOME
/templates templatesln -nfs
$APIGEECTL_HOME
/plugins plugins -
如要確認符號連結是否正確建立,請執行下列指令,並確認連結路徑指向正確位置:
ls -l | grep ^l
- 執行初始化模擬測試,檢查是否有錯誤:
${APIGEECTL_HOME}/apigeectl init -f ./overrides/OVERRIDES.yaml --dry-run=client
其中 OVERRIDES 是覆寫檔案的名稱。
- 如果沒有錯誤,請初始化 hybrid 1.7.6:
${APIGEECTL_HOME}/apigeectl init -f ./overrides/OVERRIDES.yaml
- 檢查初始化狀態:
${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
- 執行
apply
指令的模擬測試,檢查是否有錯誤:${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --dry-run=client
- 如果沒有任何錯誤,請套用覆寫值。請根據安裝方式,選取並遵循實際工作環境或示範/實驗環境的操作說明。
生產
在實際環境中,您應個別升級每個混合型元件,並在繼續升級其他元件前,先檢查已升級元件的狀態。
- 確認您位於
hybrid-files
目錄。 - 套用覆寫值來升級 Cassandra:
${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --datastore
- 檢查完成情況:
${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
只有在 Pod 就緒時,才繼續執行下一個步驟。
- 套用覆寫值來升級遙測元件,並檢查完成情況:
${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --telemetry
${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
- 啟動 Redis 元件:
${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --redis
- 套用覆寫值來升級機構層級元件 (MART、Watcher 和 Apigee Connect),並檢查完成情況:
${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --org
${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
- 套用覆寫值來升級環境。您有兩種選擇:
- 逐一環境:一次將覆寫值套用至一個環境,並檢查是否完成。針對每個環境重複執行這個步驟:
${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --env ENV_NAME
${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
其中 ENV_NAME 是您要升級的環境名稱。
- 一次套用至所有環境:一次將覆寫值套用至所有環境,並檢查完成情況:
${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml --all-envs
${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
- 逐一環境:一次將覆寫值套用至一個環境,並檢查是否完成。針對每個環境重複執行這個步驟:
示範/實驗
在大多數的示範或實驗環境中,您可以一次將覆寫值套用至所有元件。如果您的示範/實驗環境龐大且複雜,或與實際執行環境相似,建議您參考升級實際執行環境的操作說明
- 確認您位於
hybrid-files
目錄。 ${APIGEECTL_HOME}/apigeectl apply -f ./overrides/OVERRIDES.yaml
- 查看狀態:
${APIGEECTL_HOME}/apigeectl check-ready -f ./overrides/OVERRIDES.yaml
- 確認您位於
-
將下列符號連結更新為
將 cert-manager 升級至 1.7.2 版
如果您執行的是 cert-manager
1.7.2 以下版本,請升級至 1.7.2 版。
-
使用下列指令查看目前的
cert-manager
版本:kubectl -n cert-manager get deployment -o yaml | grep 'image:'
系統會傳回類似以下的內容:
image: quay.io/jetstack/cert-manager-controller:v1.7.2 image: quay.io/jetstack/cert-manager-cainjector:v1.7.2 image: quay.io/jetstack/cert-manager-webhook:v1.7.2
-
使用下列指令移除部署:
$ kubectl delete -n cert-manager deployment cert-manager cert-manager-cainjector cert-manager-webhook
-
使用下列指令將
cert-manager
升級至 1.7.2 版:$ kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.7.2/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 版本 的程序如下:
- 準備升級。
- 安裝新版的 ASM。
- 從目前的已安裝項目中刪除先前 ASM 版本的部署、服務和 webhook。
- 升級閘道並設定新的 webhook。
如要將 GKE 上的混合式升級至 ASM 版本,請按照以下步驟操作:
- 查看「升級 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: 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 說明文件中以下各節的操作說明進行:
- 下載 asmcli
- 授予叢集管理員權限
- 驗證專案和叢集
- 升級至含選用功能的方案。在開始「升級網關」部分前先停下
- 刪除變異 Webhook 和驗證 Webhook:
cd
至安裝asmcli
的目錄。- 將目前的新修訂版本儲存在環境變數中,以便在刪除 webhook 時使用:
UPGRADE_REV=""
- 建立包含下列指令的指令稿:
#!/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
- AWS 中的 Anthos 叢集
- Amazon EKS
混合式安裝作業升級至 ASM 版本 的程序如下:
- 準備升級。
- 安裝新版的 ASM。
- 從目前的已安裝項目中刪除先前 ASM 版本的部署、服務和 webhook。
- 升級閘道並設定新的 webhook。
- 查看「升級 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: 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 說明文件中以下各節的操作說明進行:
- 下載 asmcli
- 授予叢集管理員權限
- 驗證專案和叢集
- 升級至含選用功能的方案。在開始「升級網關」部分前先停下
- 刪除變異 Webhook 和驗證 Webhook:
cd
至安裝asmcli
的目錄。- 將目前的新修訂版本儲存在環境變數中,以便在刪除 webhook 時使用:
UPGRADE_REV=""
- 建立包含下列指令的指令稿:
#!/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) 版本的程序,與執行全新安裝程序相同。
準備安裝 Anthos 服務網格
- 刪除變異 Webhook 和驗證 Webhook:
cd
至安裝asmcli
的目錄。- 將目前的新修訂版本儲存在環境變數中,以便在刪除 webhook 時使用:
UPGRADE_REV=""
- 建立包含下列指令的 Shell 指令碼:
#!/bin/bash set -ex 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 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。
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/-linux-amd64.tar.gz
- 下載簽章檔案,然後使用 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 - 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
tar xzf -linux-amd64.tar.gz
這個指令會在目前工作目錄中建立名為
的安裝目錄,其中包含:
samples
目錄中的範例應用程式。- 用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 請確認您位於 Anthos 服務網格安裝的根目錄中:
cd
- 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
export PATH=$PWD/bin:$PATH
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/-osx.tar.gz
- 下載簽章檔案,然後使用 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 - 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
tar xzf -osx.tar.gz
這個指令會在目前工作目錄中建立名為
的安裝目錄,其中包含:
samples
目錄中的範例應用程式。- 用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 請確認您位於 Anthos 服務網格安裝的根目錄中:
cd
- 為方便起見,請將 /bin 目錄中的工具新增至 PATH:
export PATH=$PWD/bin:$PATH
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/-win.zip
- 下載簽章檔案,然後使用 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 - 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
tar xzf -win.zip
這個指令會在目前工作目錄中建立名為
的安裝目錄,其中包含:
samples
目錄中的範例應用程式。- 用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests\profiles
目錄中。
- 請確認您位於 Anthos 服務網格安裝的根目錄中:
cd
- 為方便起見,請將 \bin 目錄中的工具新增至 PATH:
set PATH=%CD%\bin:%PATH%
- 安裝 ASM Istio 後,請檢查
istioctl
的版本:istioctl version
- 為控制平面元件建立名為 istio-system 的命名空間:
kubectl create namespace istio-system
Linux
Mac OS
Windows
安裝 Anthos 服務網格
- 編輯
overlay.yaml
檔案或建立新的檔案,並加入以下內容:apiVersion: install.istio.io/v1alpha1 kind: IstioOperator spec: meshConfig: accessLogFile: /dev/stdout enableTracing: true 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)%"}' components: - enabled: true name: istio-ingressgateway k8s: service: type: LoadBalancer ports: - name: status-port port: 15021 targetPort: 15021 - name: http2 port: 80 targetPort: 8080 - name: https port: 443 targetPort: 8443
- 使用
asm-multicloud
設定檔,透過istioctl
安裝 Anthos 服務網格:istioctl install \ --set profile=asm-multicloud \ --set revision="" \ --filename overlayfile.yaml
輸出內容應如下所示:
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 上的標籤相符的修訂版本標記命名空間。 - 確認安裝作業已完成:
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 服務網格
- 刪除變異 Webhook 和驗證 Webhook:
cd
至安裝asmcli
的目錄。- 將目前的新修訂版本儲存在環境變數中,以便在刪除 webhook 時使用:
UPGRADE_REV=""
- 建立包含下列指令的 Shell 指令碼:
#!/bin/bash set -ex 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。
- 使用下列 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/-linux-amd64.tar.gz
- 下載簽章檔案,然後使用 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 - 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
tar xzf -linux-amd64.tar.gz
這個指令會在目前工作目錄中建立名為
的安裝目錄,其中包含:
samples
目錄中的範例應用程式。- 用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 請確認您位於 Anthos 服務網格安裝的根目錄中:
cd
- 為方便起見,請將 /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/-osx.tar.gz
- 下載簽章檔案,然後使用 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 - 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
tar xzf -osx.tar.gz
這個指令會在目前工作目錄中建立名為
的安裝目錄,其中包含:
samples
目錄中的範例應用程式。- 用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 請確認您位於 Anthos 服務網格安裝的根目錄中:
cd
- 為方便起見,請將 /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/-win.zip
- 下載簽章檔案,然後使用 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 - 將檔案的內容解壓縮到您檔案系統上的任何位置,例如,如要將內容擷取至目前的工作目錄:
tar xzf -win.zip
這個指令會在目前工作目錄中建立名為
的安裝目錄,其中包含:
samples
目錄中的範例應用程式。- 用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests\profiles
目錄中。
- 請確認您位於 Anthos 服務網格安裝的根目錄中:
cd
- 為方便起見,請將 \bin 目錄中的工具新增至 PATH:
set PATH=%CD%\bin:%PATH%
- 安裝 ASM Istio 後,請檢查
istioctl
的版本:istioctl version
- 為控制平面元件建立名為 istio-system 的命名空間:
kubectl create namespace istio-system
Linux
Mac OS
Windows
安裝 Anthos 服務網格
- 編輯
overlay.yaml
檔案或建立新的檔案,並加入以下內容:apiVersion: install.istio.io/v1alpha1 kind: IstioOperator spec: meshConfig: accessLogFile: /dev/stdout enableTracing: true 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)%"}' components: - enabled: true name: istio-ingressgateway k8s: service: type: LoadBalancer ports: - name: status-port port: 15021 targetPort: 15021 - name: http2 port: 80 targetPort: 8080 - name: https port: 443 targetPort: 8443
- 使用
asm-multicloud
設定檔,透過istioctl
安裝 Anthos 服務網格:istioctl install \ --set profile=asm-multicloud \ --set revision="" \ --filename overlayfile.yaml
輸出內容應如下所示:
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.6.11-asm.1
格式編寫的修訂版本標籤新增至 istiod。自動附加元件注入器 webhook 會使用修訂版本標籤,將注入的附加元件與特定 istiod 修訂版本建立關聯。如要為命名空間啟用自動補充插入功能,您必須使用與 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- ClusterIP 172.200.63.220 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 3m43s
復原升級
如要還原先前的升級,請按照下列步驟操作:
- 清理混合式執行階段命名空間的已完成工作,其中 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_HOME}/apigeectl apply
,檢查 Pod 狀態,然後執行${APIGEECTL_HOME}/apigeectl init
。請務必使用原始覆寫檔案,以便還原至所需版本:- 在
hybrid-files
目錄中執行${APIGEECTL_HOME}/apigeectl apply
:${APIGEECTL_HOME}/apigeectl apply -f ./overrides/ORIGINAL_OVERRIDES.yaml
其中 ORIGINAL_OVERRIDES 是舊版混合式安裝的覆寫檔案,例如
overrides1.6.yaml
。 - 請檢查這些 pod 的狀態:
kubectl -n NAMESPACE get pods
其中 NAMESPACE 是 Apigee 混合式命名空間。
- 檢查
apigeeds
的狀態: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
只有在
apigeeds
pod 執行時,才能繼續進行下一個步驟。 - 執行
apigeectl init
:${APIGEECTL_HOME}/apigeectl init -f ./overrides/ORIGINAL_OVERRIDES.yaml
- 在