在 Google Cloud 控制台中,於 GKE 叢集上佈建代管 Cloud Service Mesh
Cloud Service Mesh 是 Google 的服務網格產品,以開放原始碼 Istio 為基礎。使用者可以透過 GKE UI 中的 Cloud Service Mesh 功能,在新的 GKE 叢集或現有 GKE 叢集上,輕鬆佈建代管 Cloud Service Mesh。採用代管 Cloud Service Mesh 服務,即表示 Google 會代管控制層,以及網格的資料層 (選用),並以回溯相容的方式處理升級、資源調度和安全性作業。
Cloud Service Mesh 可讓您以一致的方式連結、管理及保護微服務。有了 Istio,無需變更微服務程式碼,就能管理服務之間的流量、強制執行存取權政策及匯總遙測資料。Cloud Service Mesh 也提供一系列管理功能,可簡化網格的生命週期管理。
您可以透過 kubectl 或 Istio 指令列工具 istioctl,使用自訂 Kubernetes API 設定 Istio 存取控管、路由規則和其他功能,istioctl 會提供額外的驗證。
詳情請參閱「Cloud Service Mesh」。
事前準備
- 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自體驗產品的實際應用成效。新客戶還能獲得價值 $300 美元的免費抵免額,能用於執行、測試及部署工作負載。
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Kubernetes Engine API, if it is not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Kubernetes Engine API, if it is not already enabled.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.
佈建 Cloud Service Mesh
佈建 Cloud Service Mesh 的必要步驟,取決於您是建立新的 GKE 叢集,還是在現有 GKE 叢集上佈建 Cloud Service Mesh。
透過 Cloud Service Mesh 建立 GKE 叢集
如要直接在 Google Cloud 控制台中,按照這項工作的逐步指南操作,請按一下「Guide me」(逐步引導):
前往 Google Cloud 控制台的「Google Kubernetes Engine」頁面。
按一下 add_box「建立」。
在 GKE Standard 和 GKE Autopilot 之間,點選偏好選項旁邊的「設定」。
標準
在「叢集基本資訊」部分,完成下列操作:
- 輸入叢集的名稱。
在「位置類型」下方選取「區域性」,然後為叢集選取所需的區域。
。在導覽窗格中,按一下「進階設定」。
在「服務網格」列中,按一下edit「編輯功能設定」。
勾選「啟用 Service Mesh」核取方塊。
勾選方塊後,畫面上會顯示詳細規定。相關規定包括:
- 叢集已啟用 Cloud Monitoring。
- Cloud Service Mesh 會使用 Cloud Monitoring 自動提供遙測資料和記錄。
- 叢集已啟用 Workload Identity。
- Cloud Service Mesh 會使用 Workload Identity,安全地存取必要的 Google API 和資源。
為確保服務網格的安全、監控及管理,系統會啟用
mesh.googleapis.comAPI (如果尚未啟用)。叢集已註冊至專案的機群,且已啟用 Cloud Service Mesh 機群功能。
系統會佈建及設定代管控制層,以便使用與叢集上設定的 GKE 管道相符的修訂版本。
按一下「進行變更」,自動啟用相關規定,然後按一下「儲存」。
點選「建立」。
Autopilot
在「叢集基本資訊」部分,完成下列操作:
- 輸入叢集的名稱。
為叢集選取所需的區域。
。展開「Advanced Options」(進階選項) 區段的下拉式選單。
在「Cloud Service Mesh」專區中,勾選「Enable Cloud Service Mesh」旁的方塊。
勾選方塊後,畫面上會顯示詳細規定。相關規定包括:
為確保服務網格安全無虞、受到監控及管理,系統會啟用
mesh.googleapis.comAPI (如果尚未啟用)。叢集已註冊至專案的機群,且已啟用 Cloud Service Mesh 機群功能。
系統會佈建及設定代管控制層,以便使用與叢集上設定的 GKE 管道相符的修訂版本。
按一下「套用變更」,系統就會自動啟用相關規定。
點選「建立」。
在現有 GKE 叢集上佈建 Cloud Service Mesh
前往 Google Cloud 控制台的「Google Kubernetes Engine」頁面。
選取要佈建 Cloud Service Mesh 的叢集。
在「功能」專區,點選 Cloud Service Mesh 旁的「編輯」按鈕。
點選編輯按鈕後,畫面上會顯示需求詳細資料。相關規定包括:
叢集已啟用 Cloud Monitoring。
- Cloud Service Mesh 會使用 Cloud Monitoring 自動提供遙測資料和記錄。
叢集已啟用 Workload Identity。
- Cloud Service Mesh 會使用 Workload Identity,安全地存取必要的 Google API 和資源。
為確保服務網格的安全、監控及管理,系統會啟用
mesh.googleapis.comAPI (如果尚未啟用)。叢集已註冊至專案的機群,且已啟用 Cloud Service Mesh 機群功能 (如尚未啟用)。
系統會佈建及設定代管控制層,以便使用與叢集上設定的 GKE 管道相符的修訂版本。
按一下「套用變更」,系統就會自動啟用相關規定。
後續步驟
在叢集上啟用 Cloud Service Mesh 只是第一步。如要充分運用服務網格功能,請完成下列工作:
(必要) 注入 Sidecar Proxy,提升網路安全性、可靠性和可觀測性。
(強烈建議) 部署閘道來管理輸入和輸出流量。
(強烈建議) 設定傳輸安全性,保護網格安全。
(選用) 啟用受管理資料層,自動升級 Proxy。
疑難排解
如要解決佈建 Cloud Service Mesh 時發生的問題,請參閱「透過 Google Cloud 控制台解決啟用 Cloud Service Mesh 時發生的問題」。
後續步驟
- 如要進一步瞭解代管 Cloud Service Mesh,請參閱「佈建代管 Cloud Service Mesh」。
- 如要快速瞭解本教學課程使用的 gcloud CLI,請參閱
gcloud指令。 - 如要瞭解如何在 Google Cloud 控制台中探索 Cloud Service Mesh,請參閱「在 Google Cloud 控制台中探索 Cloud Service Mesh」。
- 如要瞭解 Cloud Service Mesh 選用功能,例如 Cloud Trace、無發行版本代理程式映像檔和使用者身分驗證,請參閱「在代管 Cloud Service Mesh 上啟用選用功能」。
- 如要進一步瞭解 Cloud Service Mesh 的安全性,請參閱「Cloud Service Mesh 安全性總覽」 和「Cloud Service Mesh 安全性最佳做法」。
- 如要進一步瞭解 Cloud Service Mesh 中的遙測功能,請參閱「可觀測性總覽」