本文档介绍了如何设置和使用 Unified Maintenance。本文介绍了如何启用 Unified Maintenance API、直接查询该 API,以及如何管理自动发送到 Cloud Logging 的维护事件日志。
启用 Unified Maintenance API
如需直接查询 Unified Maintenance API,您需要在Google Cloud 项目中启用该 API。如果您想查看 App Hub 应用的维护活动,请在管理项目中启用该 API。
启用该 API 后,您可以在 GKE 舰队的“Unified Maintenance”部分查看 Unified Maintenance 事件。
启用 Maintenance API:
启用 API 所需的角色
如需启用 API,您需要拥有 Service Usage Admin IAM 角色 (roles/serviceusage.serviceUsageAdmin),该角色包含 serviceusage.services.enable 权限。了解如何授予角色。
gcloud services enable maintenance.googleapis.com
在 Cloud Logging 中接收维护活动日志
Unified Maintenance 服务会自动发送维护日志(无论是否已启用 Unified Maintenance API)。如果您在 Cloud Logging 中获得了项目的基本角色(Viewer、Editor 或 Owner),则您拥有访问 Unified Maintenance 日志所需的权限。
如需详细了解所需权限,请参阅使用 IAM 进行访问权限控制。
您无法停用统一维护,但可以选择不存储日志。如需选择停用,请参阅关闭维护日志。
如需监控项目中 Unified Maintenance 日志的资源使用情况,您可以创建指标阈值提醒政策。如需了解详情,请参阅 Google Cloud Observability 文档中的创建指标阈值提醒政策。