次要版本升級 (例如從 1.7 版升級至 1.8 版) 和修補程式版本升級 (例如從 1.8.0 版升級至 1.8.8 版) 的程序相同。
如果您是從 Apigee Hybrid 1.6 版或更舊版本升級,請先升級至 Hybrid 1.7 版,再升級至 1.8.8 版。請參閱將 Apigee Hybrid 升級至 1.7 版的操作說明。
如果您已使用 Hybrid 1.8.0 版,並想從 Anthos 服務網格遷移至 Apigee Ingress 閘道,請參閱 遷移至 Apigee Ingress 閘道。
Apigee Ingress 閘道簡介
自 1.8 版起,Apigee Hybrid 提供一項新功能,可管理 Hybrid 安裝的 Ingress 閘道,即 Apigee Ingress 閘道。Anthos 服務網格不再是混合安裝的必要條件。使用 Apigee Ingress 閘道後,Apigee 將停止為 Anthos 服務網格提供轉送設定。升級後,您必須先將流量遷移至新的 Apigee Ingress 閘道,才能開始使用這項功能。
Apigee 會使用一小部分的 Anthos 服務網格功能做為 Ingress 閘道。 從 Hybrid 1.8 版開始,Apigee Hybrid 包含 Ingress 閘道,該閘道會隨著 Apigee Hybrid 升級而安裝及升級。因此,您不需要具備 Anthos 服務網格的專業知識,即可安裝、升級及管理 Apigee Hybrid。系統會自動處理 Ingress 閘道版本和 Apigee Hybrid 版本相容性的相關問題。
遷移作業有兩種情境:
- 多叢集或多區域遷移 (建議):
切換至 Apigee 的新 Ingress 前,請先將要遷移的叢集流量全部排空至其他叢集或區域。這段時間內,您可以測試新的 Apigee Ingress 閘道是否正常運作。然後將流量轉回升級後的叢集。
- 就地升級 (不建議在正式環境中使用):
升級期間,Apigee 會使用您指定的 IP 位址啟動新的 Ingress 閘道。 接著,您可以測試新的 Apigee 進入閘道是否正常運作,然後將流量轉移至新的進入閘道。升級期間可能會停機。
將 Apigee Hybrid 升級至 1.8 版時,您必須在覆寫檔案中設定 Apigee Ingress 閘道。升級後,您可以在註冊機構將 A 或 CNAME 記錄導向 Apigee 輸入閘道或 Anthos Service Mesh 的 IP 位址,控管叢集使用的輸入閘道類型。
升級至 1.8.8 版總覽
升級 Apigee Hybrid 的程序分為下列幾節:
- 準備升級。
- 安裝混合式執行階段 1.8.8 版。
- 針對 Ingress 閘道,請選擇下列其中一個選項:
- (建議) 使用新的 Apigee Ingress 閘道,然後按照「將流量從 Anthos 服務網格切換至 Apigee Ingress 閘道」中的步驟操作。
- 繼續使用 Anthos 服務網格做為輸入閘道。
必要條件
這些升級操作說明假設您已安裝 Apigee Hybrid 1.7.x 版,或是 1.8.x 版的舊版修補程式,並希望升級至 1.8.8 版。如要從舊版更新,請參閱將 Apigee Hybrid 升級至 1.7 版的操作說明。
如果想繼續使用 Anthos 服務網格,請務必將 Anthos 服務網格升級至支援的版本。如要查看支援的 Anthos 服務網格版本,請參閱「支援的平台」表格。
準備升級至 1.8 版
備份混合式安裝設定 (建議)
- 這些操作說明會使用環境變數 APIGEECTL_HOME,代表您在檔案系統中安裝
apigeectl
的目錄。如有需要,請將目錄變更為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.7 版的
$APIGEECTL_HOME/
目錄。例如:tar -czvf $APIGEECTL_HOME/../apigeectl-v1.7-backup.tar.gz $APIGEECTL_HOME
- 按照「Cassandra 備份與復原」一文中的說明備份 Cassandra 資料庫。
將「Cloud Trace 代理人」角色新增至 Apigee 執行階段的服務帳戶。(選填)
選用步驟:如果您打算使用 Cloud Trace,且尚未在混合式 1.7 安裝中執行此步驟,請確保 Apigee 執行階段服務的服務帳戶具有 Cloud Trace 代理者 Google 角色。(roles/cloudtrace.agent
)。
在正式環境中,這通常是 apigee-runtime
服務帳戶。如果是非正式環境,通常是 apigee-non-prod
服務帳戶。
您可以在 Cloud 控制台 > IAM 與管理 > 服務帳戶使用者介面中新增角色,也可以使用下列指令:
- 使用下列指令取得服務帳戶的電子郵件地址:
正式版
gcloud iam service-accounts list --filter "apigee-runtime"
如果符合
apigee-runtime@$ORG_NAME.iam.gserviceaccount.com
模式,您可以在下一個步驟中使用該模式。非正式環境
gcloud iam service-accounts list --filter "apigee-non-prod"
如果符合
apigee-non-prod@$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"
非正式環境
gcloud projects add-iam-policy-binding $PROJECT_ID \ --member="serviceAccount:apigee-non-prod@$PROJECT_ID.iam.gserviceaccount.com" \ --role="roles/cloudtrace.agent"
範例
gcloud projects add-iam-policy-binding hybrid-example-project \ --member="serviceAccount:apigee-runtime@hybrid-example-project.iam.gserviceaccount.com" \ --role="roles/cloudtrace.agent"
其中:$PROJECT_ID 是安裝 Apigee Hybrid 的 Google Cloud 專案名稱。
準備安裝 Apigee Ingress 閘道
在升級過程中安裝 Apigee Ingress 閘道。您需要在覆寫檔案中新增下列
ingressGateways
屬性。
語法
ingressGateways: - name: INGRESS_NAME replicaCountMin: REPLICAS_MIN replicaCountMax: REPLICAS_MAX resources: requests: cpu: CPU_COUNT_REQ memory: MEMORY_REQ limits: cpu: CPU_COUNT_LIMIT memory: MEMORY_LIMIT svcAnnotations: # optional. See Known issue 243599452. SVC_ANNOTATIONS_KEY: SVC_ANNOTATIONS_VALUE svcLoadBalancerIP: SVC_LOAD_BALANCER_IP # optional
範例
ingressGateways: - name: prod1 replicaCountMin: 2 replicaCountMax: 100 resources: requests: cpu: 1 memory: 1Gi limits: cpu: 2 memory: 2Gi
- INGRESS_NAME 是 Ingress 部署作業的名稱。名稱必須符合下列規定:
- 長度上限為 17 個半形字元
- 只能包含小寫英數字元、「-」或「.」
- 開頭為英數字元
- 結尾為英數字元
請參閱「設定屬性參考資料」一節中的
ingressGateways[].name
。 - REPLICAS_MIN 和 REPLICAS_MAX 是安裝中 Apigee Ingress 閘道的副本數量下限和上限。如需更多資訊和預設設定,請參閱「設定屬性參考資料」中的
ingressGateways[].replicaCountMin
和ingressGateways[].replicaCountMax
。 - CPU_COUNT_REQ 和 MEMORY_REQ 是安裝中每個 Apigee Ingress 閘道副本的 CPU 和記憶體要求。
如要瞭解詳情和預設設定,請參閱「設定屬性參考資料」中的
ingressGateways[].resources.requests.cpu
和ingressGateways[].resources.requests.memory
。 - CPU_COUNT_LIMIT 和 MEMORY_LIMIT:安裝中每個 Apigee Ingress 閘道副本的 CPU 和記憶體上限。
如需更多資訊和預設設定,請參閱「設定屬性參考資料」中的
ingressGateways[].resources.limits.cpu
和ingressGateways[].resources.limits.memory
。 - SVC_ANNOTATIONS_KEY 和 SVC_ANNOTATIONS_VALUE (選用):
這是鍵/值組合,可為預設 Ingress 服務提供註解。雲端平台會使用註解來協助設定混合式安裝作業,例如將負載平衡器類型設為內部或外部。例如:
ingressGateways: svcAnnotations: networking.gke.io/load-balancer-type: "Internal"
註解會因平台而異。如需必要和建議的註解,請參閱平台說明文件。
請參閱「設定屬性參考資料」中的ingressGateways[].svcAnnotations
。 - SVC_LOAD_BALANCER_IP (選用) 可為負載平衡器指派靜態 IP 位址。在支援指定負載平衡器 IP 位址的平台上,系統會使用這個 IP 位址建立負載平衡器。如果平台不允許您指定負載平衡器 IP 位址,系統會忽略這項屬性。
如果沒有為負載平衡器分配靜態 IP 位址,請將這個屬性從覆寫檔案中排除。
請參閱設定屬性參考資料中的ingressGateways[].svcLoadBalancerIP
。
對覆寫檔案進行其他變更,啟用或停用選用的 v1.8 功能
在 overrides.yaml
檔案中加入下列屬性,即可在混合式 v1.8 中啟用新功能。這些功能為選用項目。
- 機構範圍的 UDCA 現已預設為開啟。使用單一 UDCA 部署作業處理所有環境的流量,可避免 UDCA Pod 未充分利用,並增加其他 Apigee 元件的節點資源可用性。機構範圍的 UDCA 會為所有環境使用單一服務帳戶,即
apigee-udca
。如果您在不同環境中為 UDCA 使用不同的服務帳戶,請注意,現在系統會使用覆寫檔案中以
udca:serviceAccountPath
指定的機構層級服務帳戶,而不是以envs:udca:serviceAccountPath
指定的環境層級服務帳戶。Apigee Hybrid 1.8 版支援環境範圍的 UDCA。如要保留每個環境的 UDCA,請設定
orgScopedUDCA: false
。請參閱設定屬性參考資料中的
orgScopedUDCA
。 - 啟用
validateOrg
,強制驗證 Apigee 機構和環境是否處於啟用狀態,以及是否與overrides
檔案中指定的 Google Cloud Platform 專案搭配使用。validateOrg: true
請參閱「設定屬性參考資料」中的
validateOrg
。
安裝 Hybrid 1.8.8 執行階段
- 請務必位於混合式基本目錄 (
apigeectl
可執行檔所在目錄的父項):cd $APIGEECTL_HOME/..
-
使用下列指令,下載適用於您作業系統的版本套件。 請務必在下表中選取您的平台:
Linux
Linux 64 位元:
curl -LO \ https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/1.8.8/apigeectl_linux_64.tar.gz
Mac OS
Mac 64 位元:
curl -LO \ https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/1.8.8/apigeectl_mac_64.tar.gz
Windows
Windows 64 位元:
curl -LO ^ https://storage.googleapis.com/apigee-release/hybrid/apigee-hybrid-setup/1.8.8/apigeectl_windows_64.zip
- 將目前的
apigeectl/
目錄重新命名為備份目錄名稱。例如:Linux
mv $APIGEECTL_HOME/ $APIGEECTL_HOME-v1.7/
Mac OS
mv $APIGEECTL_HOME/ $APIGEECTL_HOME-v1.7/
Windows
rename %APIGEECTL_HOME% %APIGEECTL_HOME%-v1.7
-
將下載的 gzip 檔案內容解壓縮至混合式基本目錄。 混合式基礎目錄是重新命名的
apigeectl-v1.7
目錄所在目錄:Linux
tar xvzf filename.tar.gz -C ./
Mac OS
tar xvzf filename.tar.gz -C ./
Windows
tar xvzf filename.zip -C ./
-
根據預設,tar 內容會展開至目錄,且目錄名稱中含有版本和平台。例如:
./apigeectl_1.8.8-xxxxxxx_linux_64
。使用下列指令將該目錄重新命名為apigeectl
:Linux
mv apigeectl_1.8.8-xxxxxxx_linux_64 apigeectl
Mac OS
mv apigeectl_1.8.8-xxxxxxx_mac_64 apigeectl
Windows
rename apigeectl_1.8.8-xxxxxxx_windows_64 apigeectl
-
切換至
apigeectl
目錄:cd ./apigeectl
這個目錄是
apigeectl
主目錄。這是apigeectl
可執行指令所在的位置。 - 這些操作說明會使用環境變數
$APIGEECTL_HOME
,代表檔案系統中安裝apigeectl
公用程式的目錄。如有需要,請將目錄變更為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.8.8
- 移至
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_FILE --dry-run=client
其中 OVERRIDES_FILE 是覆寫檔案的名稱,例如
./overrides/overrides.yaml
。 - 如果沒有任何錯誤,請初始化 Hybrid 1.8.8。這項指令也會安裝及設定 Apigee Ingress 閘道:
$APIGEECTL_HOME/apigeectl init -f OVERRIDES_FILE
- 檢查初始化狀態:
$APIGEECTL_HOME/apigeectl check-ready -f OVERRIDES_FILE
成功之後,輸出內容會顯示:
All containers ready.
如要進一步檢查,您也可以執行下列指令來檢查 ApigeeDataStore 狀態:
kubectl describe apigeeds -n apigee
在輸出內容中,尋找
State: running
。 - 使用
--dry-run
旗標執行apply
指令的模擬測試,檢查是否有錯誤:$APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE --dry-run=client
- 如果沒有錯誤,請套用覆寫。請根據安裝環境,選取並按照正式環境或非正式環境的操作說明進行。
生產
在正式環境中,您應個別升級每個混合式元件,並在繼續下一個元件之前,檢查升級元件的狀態。
- 請確認您位於
hybrid-files
目錄。 - 套用覆寫項目來升級 Cassandra:
$APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE --datastore
- 完成檢查:
$APIGEECTL_HOME/apigeectl check-ready -f OVERRIDES_FILE
只有在 Pod 準備就緒時,才繼續執行下一個步驟。
- 套用覆寫項目來升級遙測元件,並檢查是否完成:
$APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE --telemetry
$APIGEECTL_HOME/apigeectl check-ready -f OVERRIDES_FILE
- 啟動 Redis 元件:
$APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE --redis
- 套用覆寫項目,升級機構層級元件 (MART、Watcher 和 Apigee Connect),並檢查是否完成:
$APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE --org
$APIGEECTL_HOME/apigeectl check-ready -f OVERRIDES_FILE
- 套用覆寫內容來升級環境。你有兩種選擇:
- 逐一環境:一次對一個環境套用覆寫,並檢查完成情況。針對每個環境重複這個步驟:
$APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE --env ENV_NAME
$APIGEECTL_HOME/apigeectl check-ready -f OVERRIDES_FILE
其中 ENV_NAME 是要升級的環境名稱。
- 一次套用至所有環境:一次將覆寫值套用至所有環境,並檢查完成情況:
$APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE --all-envs
$APIGEECTL_HOME/apigeectl check-ready -f OVERRIDES_FILE
- 逐一環境:一次對一個環境套用覆寫,並檢查完成情況。針對每個環境重複這個步驟:
- 套用覆寫項目來升級
virtualhosts
元件,並檢查是否完成:$APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE --settings virtualhosts
$APIGEECTL_HOME/apigeectl check-ready -f OVERRIDES_FILE
非正式環境
在大多數非正式、示範或實驗環境中,您可以一次將覆寫套用至所有元件。如果非正式環境規模龐大且複雜,或與正式環境非常相似,建議按照升級正式環境的指示操作。
- 請確認您位於
hybrid-files
目錄。 $APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE
- 查看狀態:
$APIGEECTL_HOME/apigeectl check-ready -f OVERRIDES_FILE
- 請確認您位於
升級 Kubernetes 版本
將 Kubernetes 平台升級至 Hybrid 1.8 支援的版本。 如需協助,請參閱相關平台的說明文件。
將流量從 Anthos Service Mesh 切換至 Apigee Ingress 閘道
如要將流量切換至 Apigee 輸入閘道,請按照下列步驟操作:
- 公開 Apigee 輸入閘道。按照「公開 Apigee Ingress 閘道」中的程序操作。
- 呼叫 Proxy,測試新的 Ingress 閘道。最好測試目前部署的所有重要 Proxy。
- 如要切換流量,請更新 DNS 記錄,使其指向新 Apigee Ingress Gateway 的 IP 位址。
視 DNS 供應商而定,您或許可以逐步將流量轉移至新端點。
提示: 您可以使用下列指令,找出 Apigee 輸入閘道的外部 IP 位址: kubectl get svc -n apigee -l app=apigee-ingressgateway
輸出內容應如下所示:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE apigee-ingressgateway-prod-hybrid-37a39bd LoadBalancer 192.0.2.123 233.252.0.123 15021:32049/TCP,80:31624/TCP,443:30723/TCP 16h
- 請監控資訊主頁,確保所有執行階段流量都能正常運作。如果一切正常,請繼續下一個步驟。請確認沒有任何流量通過舊的 Ingress 閘道 (Anthos 服務網格),因為 DNS 記錄更新可能需要一段時間才能傳播,這是 DNS 快取所致。
- 如要停止讓 Apigee 為 Anthos 服務網格提供設定,請按照「管理 Apigee Ingress 閘道」指南中的「停止為 ASM 提供設定」一節步驟操作。
- 重新測試及監控 API Proxy 流量。
- 按照 Anthos 服務網格說明文件中的操作說明,從叢集解除安裝 Anthos 服務網格。
將 Anthos 服務網格升級至 1.15 版
<0x0A請參閱適用於您平台的 Anthos 服務網格說明文件,按照程序操作:
安裝及設定 Anthos 服務網格的說明會因平台而異。平台可分為下列類別:
- 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
如要將混合式安裝升級至 Anthos 服務網格 1.17.8 版,請按照下列順序操作:
- 為升級做好準備。
- 安裝新版 Anthos Service Mesh。
- 從目前的安裝作業中,刪除先前 Anthos 服務網格版本的部署作業、服務和 Webhook。
- 升級閘道並設定新的 Webhook。
準備將 Anthos 服務網格升級至 1.17.8 版
- 請先查看「升級 Anthos 服務網格」中的需求,但暫時不要執行升級。
- 安裝新版本前,請先判斷目前的修訂版本。您需要這項資訊,才能從目前的安裝項目中刪除舊版 Anthos 服務網格的部署項目、服務和 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
輸出內容應如下所示:
1.16
- 建立新的
overlay.yaml
檔案,或確認現有的overlay.yaml
檔案包含下列內容:apiVersion: install.istio.io/v1alpha1 kind: IstioOperator spec: 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)%"}'
- 請按照 Anthos 服務網格說明文件下列章節中的操作說明進行:
- 切換至新的控制層:
- 取得
istiod
上的修訂版本標籤:kubectl get pod -n istio-system -L istio.io/rev
指令輸出內容如下所示。
NAME READY STATUS RESTARTS AGE REV istiod-asm-Cloud Service Mesh 1.17.8-asm.4-67998f4b55-lrzpz 1/1 Running 0 68m 1.16.7-asm istiod-asm-Cloud Service Mesh 1.17.8-asm.4-67998f4b55-r76kr 1/1 Running 0 68m 1.16.7-asm istiod-Cloud Service Mesh 1.16.7-asm.1-1-5cd96f88f6-n7tj9 1/1 Running 0 27s asm-1178-1 istiod-Cloud Service Mesh 1.16.7-asm.1-1-5cd96f88f6-wm68b 1/1 Running 0 27s asm-1178-1
- 將較新的修訂版本標籤指派給環境變數。
在輸出內容的
REV
欄下方,記下新版本的修訂標籤值。在本範例中,這個值為asm-1178-1
export UPGRADE_REV="REVISION_LABEL"
- 使用下列指令,將修訂版本標籤新增至
istio-system
命名空間,並移除istio-injection
標籤 (如有)。kubectl label namespace istio-system istio.io/rev=$UPGRADE_REV istio-injection- --overwrite
如果輸出內容中顯示
"istio-injection not found"
,可以忽略。也就是說,命名空間先前沒有istio-injection
標籤。如果命名空間同時具有istio-injection
和修訂版本標籤,自動插入作業就會失敗,因此 Anthos 服務網格說明文件中的所有kubectl label
指令都會移除istio-injection
標籤。 - 重新啟動 Pod,觸發重新注入。
kubectl rollout restart deployment -n istio-system
- 測試應用程式,確認工作負載是否正常運作。
- 如果其他命名空間也有工作負載,請重複上述步驟,為命名空間加上標籤並重新啟動 Pod。
- 取得
- 刪除先前版本:
- 前往安裝
asmcli
的目錄。 - 將 Anthos 服務網格安裝的輸出目錄儲存在
DIR_PATH
環境變數中。這是您在「運用選用功能升級」程序中指定的目錄。export DIR_PATH=OUTPUT_DIR
- 建立包含下列指令的殼層指令碼:
#!/bin/bash set -ex if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then kubectl apply -f ${DIR_PATH}/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
- 執行指令碼,刪除先前版本。
- 前往安裝
Google Cloud 以外
這些操作說明涵蓋下列環境的 Anthos 服務網格升級作業:
- VMware 中的 Anthos 叢集 (GKE On-Prem)
- Anthos on bare metal
- AWS 中的 Anthos 叢集
- Amazon EKS
如要將混合式安裝升級至 Anthos 服務網格 1.17.8 版,請按照下列順序操作:
- 為升級做好準備。
- 安裝新版 Anthos Service Mesh。
- 從目前的安裝作業中,刪除先前 Anthos 服務網格版本的部署作業、服務和 Webhook。
- 升級閘道並設定新的 Webhook。
準備將 Anthos 服務網格升級至 1.17.8 版
- 請先查看「升級 Anthos 服務網格」中的需求,但暫時不要執行升級。
- 安裝新版本前,請先判斷目前的修訂版本。您需要這項資訊,才能從目前的安裝項目中刪除舊版 Anthos 服務網格的部署項目、服務和 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
輸出內容應如下所示:
1.16
- 建立新的
overlay.yaml
檔案,或確認現有的overlay.yaml
檔案包含下列內容:apiVersion: install.istio.io/v1alpha1 kind: IstioOperator spec: 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)%"}'
- 請按照 Anthos 服務網格說明文件下列章節中的操作說明進行:
- 切換至新的控制層:
- 取得
istiod
上的修訂版本標籤:kubectl get pod -n istio-system -L istio.io/rev
指令輸出內容如下所示。
NAME READY STATUS RESTARTS AGE REV istiod-asm-Cloud Service Mesh 1.17.8-asm.4-67998f4b55-lrzpz 1/1 Running 0 68m 1.16.7-asm istiod-asm-Cloud Service Mesh 1.17.8-asm.4-67998f4b55-r76kr 1/1 Running 0 68m 1.16.7-asm istiod-Cloud Service Mesh 1.16.7-asm.1-1-5cd96f88f6-n7tj9 1/1 Running 0 27s asm-1178-1 istiod-Cloud Service Mesh 1.16.7-asm.1-1-5cd96f88f6-wm68b 1/1 Running 0 27s asm-1178-1
- 將較新的修訂版本標籤指派給環境變數。
在輸出內容的
REV
欄下方,記下新版本的修訂標籤值。在本範例中,這個值為asm-1178-1
export UPGRADE_REV="REVISION_LABEL"
- 使用下列指令,將修訂版本標籤新增至
istio-system
命名空間,並移除istio-injection
標籤 (如有)。kubectl label namespace istio-system istio.io/rev=$UPGRADE_REV istio-injection- --overwrite
如果輸出內容中顯示
"istio-injection not found"
,可以忽略。也就是說,命名空間先前沒有istio-injection
標籤。如果命名空間同時具有istio-injection
和修訂版本標籤,自動插入作業就會失敗,因此 Anthos 服務網格說明文件中的所有kubectl label
指令都會移除istio-injection
標籤。 - 重新啟動 Pod,觸發重新注入。
kubectl rollout restart deployment -n istio-system
- 測試應用程式,確認工作負載是否正常運作。
- 如果其他命名空間也有工作負載,請重複上述步驟,為命名空間加上標籤並重新啟動 Pod。
- 取得
- 刪除先前版本:
- 前往安裝
asmcli
的目錄。 - 將 Anthos 服務網格安裝的輸出目錄儲存在
DIR_PATH
環境變數中。這是您在「運用選用功能升級」程序中指定的目錄。export DIR_PATH=OUTPUT_DIR
- 建立包含下列指令的殼層指令碼:
#!/bin/bash set -ex if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then kubectl apply -f ${DIR_PATH}/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
- 執行指令碼,刪除先前版本。
- 前往安裝
AKS / EKS
在這些操作說明中,升級 Anthos 連接叢集上 Anthos 服務網格 (Anthos 服務網格) 1.17.8-asm.4-distroless 版的程序,與全新安裝程序相同。
準備安裝 Anthos Service Mesh
- 安裝新版本前,請先判斷目前的修訂版本。您需要這項資訊,才能從目前的 Anthos 服務網格安裝中刪除驗證 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
輸出內容應如下所示:
1.16
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/1.17.8-asm.4-distroless-linux-amd64.tar.gz
- 下載簽章檔案,並使用 OpenSSL 驗證簽章:
curl -LO https://storage.googleapis.com/gke-release/asm/1.17.8-asm.4-distroless-linux-amd64.tar.gz.1.sig
openssl dgst -verify /dev/stdin -signature 1.17.8-asm.4-distroless-linux-amd64.tar.gz.1.sig 1.17.8-asm.4-distroless.tar.gz <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf 1.17.8-asm.4-distroless-linux-amd64.tar.gz
這個指令會在目前的工作目錄中建立名為
1.17.8-asm.4-distroless
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd 1.17.8-asm.4-distroless
- 為方便起見,請將
/bin
目錄中的工具新增至PATH
:export PATH=$PWD/bin:$PATH
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/1.17.8-asm.4-distroless-osx.tar.gz
- 下載簽章檔案,並使用 OpenSSL 驗證簽章:
curl -LO https://storage.googleapis.com/gke-release/asm/1.17.8-asm.4-distroless-osx.tar.gz.1.sig
openssl dgst -sha256 -verify /dev/stdin -signature 1.17.8-asm.4-distroless-osx.tar.gz.1.sig 1.17.8-asm.4-distroless.tar.gz <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf 1.17.8-asm.4-distroless-osx.tar.gz
這個指令會在目前的工作目錄中建立名為
1.17.8-asm.4-distroless
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd 1.17.8-asm.4-distroless
- 為方便起見,請將
/bin
目錄中的工具新增至PATH
:export PATH=$PWD/bin:$PATH
- 將 Anthos 服務網格安裝檔案下載至目前的工作目錄:
curl -LO https://storage.googleapis.com/gke-release/asm/1.17.8-asm.4-distroless-win.zip
- 下載簽章檔案,並使用 OpenSSL 驗證簽章:
curl -LO https://storage.googleapis.com/gke-release/asm/1.17.8-asm.4-distroless-win.zip.1.sig
openssl dgst -verify - -signature 1.17.8-asm.4-distroless-win.zip.1.sig 1.17.8-asm.4-distroless.win.zip <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf 1.17.8-asm.4-distroless-win.zip
這個指令會在目前的工作目錄中建立名為
1.17.8-asm.4-distroless
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests\profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd 1.17.8-asm.4-distroless
- 為方便起見,請將 \bin 目錄中的工具新增至 PATH:
set PATH=%CD%\bin:%PATH%
- Anthos 服務網格 Istio 安裝完成後,請檢查
istioctl
的版本:istioctl version
- 為控制層元件建立名為 istio-system 的命名空間:
kubectl create namespace istio-system
Linux
Mac OS
Windows
安裝 Anthos Service Mesh
- 編輯
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: ingressGateways: - name: istio-ingressgateway enabled: true 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="asm-1178-1" \ --filename overlay.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-asm-1178-1-798ffb964-2ls88 1/1 Running 0 3m21s istiod-asm-1178-1-798ffb964-fnj8c 1/1 Running 1 3m21s
--set revision
引數會將修訂版本標籤新增至istiod
,格式為istio.io/rev=asm-1178-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-1178-1 ClusterIP 172.200.63.220 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 3m43s
- 切換至新的控制層:
- 取得
istiod
上的修訂版本標籤:kubectl get pod -n istio-system -L istio.io/rev
指令輸出內容如下所示。
NAME READY STATUS RESTARTS AGE REV istiod-asm-Cloud Service Mesh 1.17.8-asm.4-67998f4b55-lrzpz 1/1 Running 0 68m 1.16.7-asm istiod-asm-Cloud Service Mesh 1.17.8-asm.4-67998f4b55-r76kr 1/1 Running 0 68m 1.16.7-asm istiod-Cloud Service Mesh 1.16.7-asm.1-1-5cd96f88f6-n7tj9 1/1 Running 0 27s asm-1178-1 istiod-Cloud Service Mesh 1.16.7-asm.1-1-5cd96f88f6-wm68b 1/1 Running 0 27s asm-1178-1
- 將較新的修訂版本標籤指派給環境變數。
在輸出內容的
REV
欄下方,記下新版本的修訂標籤值。在本範例中,這個值為asm-1178-1
export UPGRADE_REV="REVISION_LABEL"
- 使用下列指令,將修訂版本標籤新增至
istio-system
命名空間,並移除istio-injection
標籤 (如有)。kubectl label namespace istio-system istio.io/rev=$UPGRADE_REV istio-injection- --overwrite
如果輸出內容中顯示
"istio-injection not found"
,可以忽略。也就是說,命名空間先前沒有istio-injection
標籤。如果命名空間同時具有istio-injection
和修訂版本標籤,自動插入作業就會失敗,因此 Anthos 服務網格說明文件中的所有kubectl label
指令都會移除istio-injection
標籤。 - 重新啟動 Pod,觸發重新注入。
kubectl rollout restart deployment -n istio-system
- 測試應用程式,確認工作負載是否正常運作。
- 如果其他命名空間也有工作負載,請重複上述步驟,為命名空間加上標籤並重新啟動 Pod。
- 取得
- 刪除先前版本:
- 前往安裝
asmcli
的目錄。 - 建立包含下列指令的殼層指令碼:
#!/bin/bash set -ex if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then 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
- 執行指令碼,刪除先前版本。
- 前往安裝
OpenShift
在這些操作說明中,升級 Anthos 連接叢集上 Anthos 服務網格 (Anthos 服務網格) 1.17.8-asm.4-distroless 版的程序,與全新安裝程序相同。
準備安裝 Anthos Service Mesh
- 安裝新版本前,請先判斷目前的修訂版本。您需要這項資訊,才能從目前的 Anthos 服務網格安裝中刪除驗證 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
輸出內容應如下所示:
1.16
- 使用下列 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/1.17.8-asm.4-distroless-linux-amd64.tar.gz
- 下載簽章檔案,並使用 OpenSSL 驗證簽章:
curl -LO https://storage.googleapis.com/gke-release/asm/1.17.8-asm.4-distroless-linux-amd64.tar.gz.1.sig
openssl dgst -verify /dev/stdin -signature 1.17.8-asm.4-distroless-linux-amd64.tar.gz.1.sig 1.17.8-asm.4-distroless.tar.gz <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf 1.17.8-asm.4-distroless-linux-amd64.tar.gz
這個指令會在目前的工作目錄中建立名為
1.17.8-asm.4-distroless
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd 1.17.8-asm.4-distroless
- 為方便起見,請將
/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/1.17.8-asm.4-distroless-osx.tar.gz
- 下載簽章檔案,並使用 OpenSSL 驗證簽章:
curl -LO https://storage.googleapis.com/gke-release/asm/1.17.8-asm.4-distroless-osx.tar.gz.1.sig
openssl dgst -sha256 -verify /dev/stdin -signature 1.17.8-asm.4-distroless-osx.tar.gz.1.sig 1.17.8-asm.4-distroless.tar.gz <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf 1.17.8-asm.4-distroless-osx.tar.gz
這個指令會在目前的工作目錄中建立名為
1.17.8-asm.4-distroless
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests/profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd 1.17.8-asm.4-distroless
- 為方便起見,請將
/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/1.17.8-asm.4-distroless-win.zip
- 下載簽章檔案,並使用 OpenSSL 驗證簽章:
curl -LO https://storage.googleapis.com/gke-release/asm/1.17.8-asm.4-distroless-win.zip.1.sig
openssl dgst -verify - -signature 1.17.8-asm.4-distroless-win.zip.1.sig 1.17.8-asm.4-distroless.win.zip <<'EOF'
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWZrGCUaJJr1H8a36sG4UUoXvlXvZ wQfk16sxprI2gOJ2vFFggdq3ixF2h4qNBt0kI7ciDhgpwS8t+/960IsIgw== -----END PUBLIC KEY----- EOF - 將檔案的內容解壓縮到您檔案系統上的任何位置,舉例來說,如要將內容解壓縮至目前的工作目錄,請執行下列指令:
tar xzf 1.17.8-asm.4-distroless-win.zip
這個指令會在目前的工作目錄中建立名為
1.17.8-asm.4-distroless
的安裝目錄,其中包含:samples
目錄中的範例應用程式。- 您用來安裝 Anthos 服務網格的
istioctl
指令列工具位於bin
目錄中。 - Anthos 服務網格設定檔位於
manifests\profiles
目錄中。
- 確認您位於 Anthos Service Mesh 安裝的根目錄中:
cd 1.17.8-asm.4-distroless
- 為方便起見,請將 \bin 目錄中的工具新增至 PATH:
set PATH=%CD%\bin:%PATH%
- Anthos 服務網格 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-1178-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-1178-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
- 編輯
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: ingressGateways: - name: istio-ingressgateway enabled: true 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="asm-1178-1" \ --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-asm-1178-1-798ffb964-2ls88 1/1 Running 0 3m21s istiod-asm-1178-1-798ffb964-fnj8c 1/1 Running 1 3m21s
--set revision
引數會將修訂版本標籤新增至istiod
,格式為istio.io/rev=1.6.11-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-1178-1 ClusterIP 172.200.63.220 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 3m43s
- 切換至新的控制層:
- 取得
istiod
上的修訂版本標籤:kubectl get pod -n istio-system -L istio.io/rev
指令輸出內容如下所示。
NAME READY STATUS RESTARTS AGE REV istiod-asm-Cloud Service Mesh 1.17.8-asm.4-67998f4b55-lrzpz 1/1 Running 0 68m 1.16.7-asm istiod-asm-Cloud Service Mesh 1.17.8-asm.4-67998f4b55-r76kr 1/1 Running 0 68m 1.16.7-asm istiod-Cloud Service Mesh 1.16.7-asm.1-1-5cd96f88f6-n7tj9 1/1 Running 0 27s asm-1178-1 istiod-Cloud Service Mesh 1.16.7-asm.1-1-5cd96f88f6-wm68b 1/1 Running 0 27s asm-1178-1
- 將較新的修訂版本標籤指派給環境變數。
在輸出內容的
REV
欄下方,記下新版本的修訂標籤值。在本範例中,這個值為asm-1178-1
export UPGRADE_REV="REVISION_LABEL"
- 使用下列指令,將修訂版本標籤新增至
istio-system
命名空間,並移除istio-injection
標籤 (如有)。kubectl label namespace istio-system istio.io/rev=$UPGRADE_REV istio-injection- --overwrite
如果輸出內容中顯示
"istio-injection not found"
,可以忽略。也就是說,命名空間先前沒有istio-injection
標籤。如果命名空間同時具有istio-injection
和修訂版本標籤,自動插入作業就會失敗,因此 Anthos 服務網格說明文件中的所有kubectl label
指令都會移除istio-injection
標籤。 - 重新啟動 Pod,觸發重新注入。
kubectl rollout restart deployment -n istio-system
- 測試應用程式,確認工作負載是否正常運作。
- 如果其他命名空間也有工作負載,請重複上述步驟,為命名空間加上標籤並重新啟動 Pod。
- 取得
- 刪除先前版本:
- 前往安裝
asmcli
的目錄。 - 建立包含下列指令的殼層指令碼:
#!/bin/bash set -ex if [[ "${DELETE_REV}" != "${UPGRADE_REV}" ]]; then 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
- 執行指令碼,刪除先前版本。
- 前往安裝
復原升級
如要復原先前的升級,請按照下列步驟操作:
- 清除混合式執行階段命名空間中已完成的工作,其中 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
- 復原對
overrides
檔案所做的變更:- 移除或排除
ingressGateways
及其所有屬性的註解。 - 將
virtualhosts.selector.app
的值設為先前的值,例如:virtualhosts: - name: my-env-group selector: app: istio-ingressgateway
- 移除或排除
ao.args.disableIstioConfigInAPIServer
的註解。
- 移除或排除
- 在要還原的安裝版本根目錄中,執行
apigeectl apply
,檢查 Pod 的狀態,然後執行apigeectl init
。請務必使用要復原版本的原始覆寫檔案:- 在 hybrid-files 目錄中,執行
apigeectl apply
:$APIGEECTL_HOME
/apigeectl apply -f ORIGINAL_OVERRIDES_FILE其中 ORIGINAL_OVERRIDES_FILE 是舊版混合式安裝的覆寫檔案相對路徑和檔案名稱,例如
./overrides/overrides1.7.yaml
。 - 檢查 pod 的狀態:
kubectl -n NAMESPACE get pods
其中 NAMESPACE 是 Apigee Hybrid 命名空間。
- 檢查
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 apply -f ORIGINAL_OVERRIDES_FILE --dry-run=client --print-yaml --env ENV_NAME 2>/dev/null |grep "runtime:" -A 25 -B 1| grep "autoScaler" -A 2
輸出內容應如下所示:
autoScaler: minReplicas: 2 maxReplicas: 10
-
如要還原至混合式 1.8.4 版或更早版本,請刪除混合式 1.8.5 版和更新版本使用的控制器部署作業:
kubectl -n apigee-system delete deploy apigee-controller-manager
- 執行
apigeectl init
:$APIGEECTL_HOME
/apigeectl init -f ORIGINAL_OVERRIDES_FILE
- 在 hybrid-files 目錄中,執行
- 刪除 Apigee 輸入閘道管理員部署作業。這個元件僅適用於 Apigee Hybrid 1.8 以上版本。
kubectl delete deployment -n NAMESPACE apigee-ingress-gateway-manager
其中 NAMESPACE 是 Apigee Hybrid 命名空間。