在 Google Cloud 控制台中为 GKE 集群配置托管式 Cloud Service Mesh
Cloud Service Mesh 是 Google 基于开源 Istio 的服务网格产品。通过 GKE 界面中的 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。
准备工作
-
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.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles. 前往 Google Cloud 控制台中的 Google Kubernetes Engine 页面。
点击 add_box 创建。
点击 GKE Standard 和 GKE Autopilot 之间的首选选项旁边的配置。
- 输入集群的名称。
对于位置类型,选择区域,然后为您的集群选择所需的区域。
在导航窗格的集群下,点击功能。
在 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 部分中,勾选 启用 Cloud Service Mesh 旁边的复选框。
选中此复选框后,系统会出现一个详细说明要求的屏幕。这些要求包括:
为了保护、监控和管理服务网格,系统会启用
mesh.googleapis.comAPI(如果尚未启用)。系统会向项目的舰队注册集群,并且启用 Cloud Service Mesh 舰队功能。
代管式控制平面已完成预配,并设置成使用与集群上配置的 GKE 渠道匹配的修订版本。
点击进行更改以自动启用要求。
点击创建。
前往 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,请参阅配置托管式 Cloud Service Mesh
- 如需快速了解本教程中使用的 gcloud CLI,请参阅
gcloud命令 - 如需了解如何在 Google Cloud 控制台中探索 Cloud Service Mesh,请参阅在 Google Cloud 控制台中探索 Cloud Service Mesh
- 如需探索 Cloud Service Mesh 的可选功能(例如 Cloud Trace、Distroless 代理映像和最终用户身份验证),请参阅在托管式 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 集群
Standard
在集群基本信息部分,完成以下操作:
Autopilot
在集群基本信息部分,完成以下操作:
在现有 GKE 集群上预配 Cloud Service Mesh
后续步骤
在集群上启用 Cloud Service Mesh 只是第一步。如需充分利用服务网格功能,请完成以下任务:
问题排查
如需解决配置 Cloud Service Mesh 时遇到的问题,请参阅解决通过 Google Cloud 控制台启用 Cloud Service Mesh 时遇到的问题。