在 Google Distributed Cloud 實作中,管理員叢集的控制層 VM 會附加兩個磁碟:
開機磁碟包含 VM 的作業系統。
資料磁碟包含憑證和 etcd 資料庫,用於儲存管理員叢集的狀態。也就是說,資料磁碟會儲存管理員叢集的所有 Kubernetes 物件。
本頁說明控制平面 VM 遺失或開機磁碟遭入侵時,如何進行復原。例如:
- 垃圾內容日誌記錄導致開機磁碟變成唯讀。
- Docker 疊加檔案系統損毀。
本頁面未說明如何復原資料磁碟。如需如何復原資料磁碟的操作說明,請參閱「還原管理員叢集」。
修復控制層 VM
修復管理員叢集的控制層 VM 時,步驟會因管理員叢集是否為高可用性 (HA) 叢集而略有不同。
HA
高可用性管理員叢集有三個控制層 VM。您至少須有兩個 VM,才能啟動叢集控制層。如果三部 VM 都失敗,請一次修復一部失敗的 VM。第二部 VM 修復並執行後,叢集控制層應會恢復運作。
執行下列指令:
gkectl repair admin-master --config ADMIN_CLUSTER_CONFIG --kubeconfig ADMIN_CLUSTER_KUBECONFIG
更改下列內容:
ADMIN_CLUSTER_CONFIG
,並提供管理員叢集設定檔的路徑。ADMIN_CLUSTER_KUBECONFIG
,並將其替換為管理員叢集的 kubeconfig 檔案路徑。
指令會輸出類似以下的結果:
Please select the control plane VM template to be used for re-creating the admin cluster's control plane VM. [1] VM template: /atl-qual-vc07/vm/gke-admin-57f8g-fx9f4c729448z2v8-2-tmpl GKE on-prem version: 1.16.0-gke.550 Creation time: 2023-07-25 01:52:51.815518 +0000 UTC CPU: 4 CPU(s) Memory: 16384 MB Data disk: [vsanDatastore] 37a73d64-b823-47cd-2e0c-00620b9189a0/gke-admin-57f8g/default/gke-admin-57f8g-2-data.vmdk [2] VM template: /atl-qual-vc07/vm/gke-admin-57f8g-fx9f4c729448z2v8-0-tmpl GKE on-prem version: 1.16.0-gke.550 Creation time: 2023-07-25 01:52:54.228252 +0000 UTC CPU: 4 CPU(s) Memory: 16384 MB Data disk: [vsanDatastore] 37a73d64-b823-47cd-2e0c-00620b9189a0/gke-admin-57f8g/default/gke-admin-57f8g-0-data.vmdk [3] VM template: /atl-qual-vc07/vm/gke-admin-57f8g-fx9f4c729448z2v8-1-tmpl GKE on-prem version: 1.16.0-gke.550 Creation time: 2023-07-25 01:52:54.210705 +0000 UTC CPU: 4 CPU(s) Memory: 16384 MB Data disk: [vsanDatastore] 37a73d64-b823-47cd-2e0c-00620b9189a0/gke-admin-57f8g/default/gke-admin-57f8g-1-data.vmdk Please enter your numeric choice:
輸入要修復的 VM 編號。如果輸出內容中未顯示 VM,請與 Google Cloud 支援團隊聯絡。
如果您有三部 VM 需要修復,
gkectl repair admin-master
會在修復第一部 VM 後輸出類似以下的錯誤訊息:If you are repairing admin control plane VM for HA admin cluster, it's possible that the API server is still down after repairing one of the VMs. Try continue fixing other control plane VMs listed to recover the quorum of control plane.
在這種情況下,請重新執行指令來修復第二部 VM。
Non-HA
執行下列指令:
gkectl repair admin-master \ --config ADMIN_CLUSTER_CONFIG \ --kubeconfig ADMIN_CLUSTER_KUBECONFIG
更改下列內容:
ADMIN_CLUSTER_CONFIG
,並提供管理員叢集設定檔的路徑。ADMIN_CLUSTER_KUBECONFIG
,並將ADMIN_CLUSTER_KUBECONFIG
換成管理員叢集的kubeconfig
檔案路徑。
管理員叢集的控制層 VM 會複製到 VM 範本,其中包含重新建立 VM 所需的所有資訊。gkectl repair admin-master
指令會使用 VM 範本建立新的 VM。然後連結新的開機磁碟和現有資料磁碟。
如果叢集節點的位址來自 DHCP 伺服器,新 VM 的 IP 位址可能與原始 VM 不同。
後續步驟
- 如需其他協助,請與 Cloud Customer Care 團隊聯絡。
如要進一步瞭解支援資源,包括下列項目,請參閱「取得支援」: