排查问题

本页面介绍如何解决在使用 Eventarc Advanced 时可能遇到的问题。

使用 Eventarc 服务代理时权限遭拒

如果您在尝试创建 Eventarc 高级资源时遇到以下错误,请等待几分钟(可能需要 7 分钟),然后再次尝试创建资源:

Permission denied while using the Eventarc Service Agent. If you recently started to use
Eventarc, it may take a few minutes before all necessary permissions are propagated to the
Service Agent. Otherwise, verify that it has Eventarc Service Agent role.

服务代理充当特定项目的给定 Google Cloud 服务的身份。如需了解详情,请参阅服务代理并查看 Eventarc 服务代理角色 (roles/eventarc.serviceAgent) 的 Identity and Access Management (IAM) 权限。

如果您在尝试重新创建资源后仍然遇到之前的错误,请完成以下步骤,验证您的 Google Cloud 项目中是否存在 Eventarc 服务代理以及该代理是否具有必要的角色:

  1. 在 Google Cloud 控制台中,前往 IAM 页面。

    转到 IAM

  2. 按主账号查看标签页中,选中包括 Google 提供的角色授权复选框。
  3. 在主账号列表中,找到 Eventarc 服务代理,它们使用以下格式:

    service-PROJECT_NUMBER@gcp-sa-eventarc.iam.gserviceaccount.com

  4. 验证服务代理是否具有 Eventarc Service Agent 角色。如果服务代理没有该角色,请授予该角色

HTTP 503 Service Unavailable 错误

如果您遇到 HTTP 503 Service Unavailable 错误,并且流水线使用 DNS 地址(例如 Cloud Run)将消息路由到 Google 目的地,请确保在网络连接中使用的子网上启用了专用 Google 访问通道;否则,DNS 地址将无法解析。

CMEK 问题

您可以使用客户管理的加密密钥 (CMEK) 来保护 Eventarc。 密钥通过 Cloud Key Management Service (Cloud KMS) 创建和管理。下表介绍了将 Cloud KMS 与 Eventarc 搭配使用时可能会遇到的不同 CMEK 问题以及如何解决这些问题。

创建或更新 Eventarc 资源时出现的问题

CMEK 问题 错误消息 说明
已停用的密钥 $KEY is not enabled, current state is: DISABLED

提供的 Cloud KMS 密钥已针对 Eventarc 资源停用。与资源关联的活动或消息不再受保护。

解决方案:

  1. 显示用于资源的密钥:
  2. 重新启用 Cloud KMS 密钥
超出配额 Quota exceeded for limit

您已达到 Cloud KMS 请求的配额上限。

解决方案:

  • 限制 Cloud KMS 调用的数量。
  • 增加配额。
如需了解详情,请参阅监控和调整 Cloud KMS 配额
区域不匹配 Key region $REGION must match the resource to be protected

提供的 KMS 密钥区域与渠道的区域不同。

解决方案:

使用来自同一区域的 Cloud KMS 密钥。 请注意,对于多区域 eu 中的渠道,应使用多区域 europe 中的 Cloud KMS 密钥对其进行保护。如需了解详情,请参阅 Cloud KMS 位置Eventarc 多区域位置。

组织政策限制条件 project/PROJECT_ID violated org policy constraint

Eventarc 集成了以下两种组织政策限制条件,以帮助确保在整个组织范围内使用 CMEK。任何现有 Eventarc 资源都不受在资源创建后设置的政策约束;不过,更新资源可能会失败。

  • constraints/gcp.restrictNonCmekServices 会导致没有指定 Cloud KMS 密钥的所有资源创建请求失败。

    解决方案:

    为 Eventarc 资源指定 Cloud KMS 密钥。如需了解详情,请参阅要求为新的 Eventarc 资源使用 CMEK

  • constraints/gcp.restrictCmekCryptoKeyProjects 限制了可用于保护 Eventarc 资源的 Cloud KMS 密钥。

    解决方案:

    使用允许的 Eventarc 项目、文件夹或组织中的受支持 Cloud KMS 密钥。如需了解详情,请参阅为 Eventarc 项目限制 Cloud KMS 密钥

活动递送期间出现的问题

CMEK 问题 错误消息 说明
已停用的密钥 $KEY is not enabled, current state is: DISABLED

提供的 Cloud KMS 密钥已针对 Eventarc 资源停用。与资源关联的活动或消息不再受保护。

解决方案:

  1. 显示用于资源的密钥:
  2. 重新启用 Cloud KMS 密钥
超出配额 Quota exceeded for limit

您已达到 Cloud KMS 请求的配额上限。

解决方案:

  • 限制 Cloud KMS 调用的数量。
  • 增加配额。
如需了解详情,请参阅监控和调整 Cloud KMS 配额
权限错误 Permission 'cloudkms.cryptoKeyVersions.useToEncrypt' denied on resource $KEY (or it may not exist)

提供的 Cloud KMS 密钥不存在,或者 Identity and Access Management (IAM) 权限未正确配置。

解决方案:

如需解决通过 Cloud External Key Manager (Cloud EKM) 使用外部管理的密钥时可能遇到的问题,请参阅 Cloud EKM 错误参考

后续步骤