在 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 可讓您以一致的方式連結、管理及保護微服務。無須變更微服務程式碼,就能管理服務之間的流量、強制執行存取政策及匯總遙測資料。Cloud Service Mesh 也提供一系列管理功能,簡化網格的生命週期管理。
您可以使用自訂 Kubernetes API (透過 kubectl 或 Istio 指令列工具 istioctl,後者提供額外的驗證),設定 Istio 存取權控管、路由規則和其他功能。
詳情請參閱 Cloud Service Mesh。
事前準備
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Kubernetes Engine API.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Kubernetes Engine API.
前往 Google Cloud 控制台的「Google Kubernetes Engine」頁面。
按一下「add_box Create」(建立)。
在 GKE Standard 和 GKE Autopilot 之間,點選偏好選項旁邊的「設定」。
- 輸入叢集的「名稱」。
在「位置類型」下方選取「區域」,然後為叢集選取所需的區域。
在導覽窗格的「Cluster」(叢集) 底下,按一下「Features」(功能)。
在「Cloud Service Mesh」專區中,勾選「Enable Cloud Service Mesh」旁的方塊。
勾選方塊後,畫面上會顯示詳細需求。相關規定包括:
- 叢集已啟用 Cloud Monitoring。
- Cloud Service Mesh 會使用 Cloud Monitoring 自動提供遙測資料和記錄。
- 叢集已啟用 Workload Identity。
- Cloud Service Mesh 會使用 Workload Identity,安全地存取必要的 Google API 和資源。
為確保服務網格安全無虞、受到監控及管理,系統會啟用
mesh.googleapis.com
API (如果尚未啟用)。叢集已註冊至專案的機群,且已啟用 Cloud Service Mesh 機群功能。
系統會佈建及設定代管控制層,以使用與叢集上設定的 GKE 管道相符的修訂版本。
按一下「進行變更」,系統就會自動啟用必要條件。
點選「建立」。
- 輸入叢集的「名稱」。
選取叢集的所需區域。
展開「Advanced Options」(進階選項) 區段的下拉式選單。
在「Cloud Service Mesh」專區中,勾選「Enable Cloud Service Mesh」旁的方塊。
勾選方塊後,畫面上會顯示詳細需求。相關規定包括:
為確保服務網格安全無虞、受到監控及管理,系統會啟用
mesh.googleapis.com
API (如果尚未啟用)。叢集已註冊至專案的機群,且已啟用 Cloud Service Mesh 機群功能。
系統會佈建及設定代管控制層,以使用與叢集上設定的 GKE 管道相符的修訂版本。
按一下「進行變更」,系統就會自動啟用必要條件。
點選「建立」。
前往 Google Cloud 控制台的「Google Kubernetes Engine」頁面。
選取要佈建 Cloud Service Mesh 的叢集。
在「Features」(功能) 專區中,按一下 Cloud Service Mesh 旁的「編輯」按鈕。
點選編輯按鈕後,畫面上會顯示詳細需求。相關規定包括:
叢集已啟用 Cloud Monitoring。
- Cloud Service Mesh 會使用 Cloud Monitoring 自動提供遙測資料和記錄。
叢集已啟用 Workload Identity。
- Cloud Service Mesh 會使用 Workload Identity,安全地存取必要的 Google API 和資源。
為確保服務網格安全無虞、受到監控及管理,系統會啟用
mesh.googleapis.com
API (如果尚未啟用)。叢集已註冊至專案的機群,且已啟用 Cloud Service Mesh 機群功能 (如果尚未啟用)。
系統會佈建及設定代管控制層,以使用與叢集上設定的 GKE 管道相符的修訂版本。
按一下「進行變更」,系統就會自動啟用必要條件。
(必要) 注入邊車模式 (side-car) Proxy,提升網路安全性、可靠性和可觀測性。
(強烈建議) 部署閘道來管理連入和連出流量。
(強烈建議) 設定傳輸安全性,保護網格安全。
(選用) 啟用受管理資料層,自動升級 Proxy。
- 如要進一步瞭解代管 Cloud Service Mesh,請參閱「佈建代管 Cloud Service Mesh」一文。
- 如要快速瞭解本教學課程使用的 gcloud CLI,請參閱
gcloud
指令 - 如要瞭解如何在 Google Cloud 控制台中探索 Cloud Service Mesh,請參閱「在 Google Cloud 控制台中探索 Cloud Service Mesh」一文。
- 如要瞭解 Cloud Service Mesh 選用功能,例如 Cloud Trace、無發行版本 Proxy 映像檔和使用者驗證,請參閱啟用代管型 Cloud Service Mesh 中的選用功能
- 如要進一步瞭解 Cloud Service Mesh 的安全性,請參閱 Cloud Service Mesh 安全性總覽和 Cloud Service Mesh 安全性最佳做法。
- 如要進一步瞭解 Cloud Service Mesh 中的遙測功能,請參閱「可觀測性總覽」
佈建 Cloud Service Mesh
佈建 Cloud Service Mesh 的必要步驟,取決於您是建立新的 GKE 叢集,還是在現有的 GKE 叢集上佈建 Cloud Service Mesh。
透過 Cloud Service Mesh 建立 GKE 叢集
如要直接在 Google Cloud 控制台按照逐步指南操作,請按一下「Guide me」(逐步引導):
標準
在「叢集基本資訊」部分,完成下列操作:
Autopilot
在「叢集基本資訊」部分,完成下列操作:
在現有的 GKE 叢集上佈建 Cloud Service Mesh
後續步驟
在叢集上啟用 Cloud Service Mesh 只是第一步。如要充分運用服務網格功能,請完成下列工作:
疑難排解
如要解決佈建 Cloud Service Mesh 時發生的問題,請參閱透過 Google Cloud 控制台解決啟用 Cloud Service Mesh 時發生的問題。