QUOTA_EXCEEDED policy resource_error ai_generated true

Error: Service account key limit exceeded. Maximum number of keys for service account: 10.

ID: policy/gcp-service-account-key-limit-exceeded

Also available as: JSON · Markdown · 中文
85%Fix Rate
88%Confidence
1Evidence
2023-06-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
GCP IAM API v1 active
gcloud CLI 400.0.0 active
Google Cloud SDK 4.0.0 active

Root Cause

GCP enforces a hard limit of 10 user-managed keys per service account; attempting to create an 11th key fails.

generic

中文

GCP 对每个服务账号强制执行10个用户管理密钥的硬性限制;尝试创建第11个密钥会失败。

Official Documentation

https://cloud.google.com/iam/docs/creating-managing-service-account-keys

Workarounds

  1. 95% success Delete unused keys using gcloud: `gcloud iam service-accounts keys list [email protected]` then `gcloud iam service-accounts keys delete KEY_ID [email protected]` to free up slots.
    Delete unused keys using gcloud: `gcloud iam service-accounts keys list [email protected]` then `gcloud iam service-accounts keys delete KEY_ID [email protected]` to free up slots.
  2. 90% success Use workload identity federation instead of service account keys for external workloads: configure a workload identity pool and provider.
    Use workload identity federation instead of service account keys for external workloads: configure a workload identity pool and provider.
  3. 85% success Create a new service account for additional workloads and assign the same roles.
    Create a new service account for additional workloads and assign the same roles.

中文步骤

  1. 使用 gcloud 删除未使用的密钥:`gcloud iam service-accounts keys list [email protected]` 然后 `gcloud iam service-accounts keys delete KEY_ID [email protected]` 以释放槽位。
  2. 对于外部工作负载,使用工作负载身份联合而不是服务账号密钥:配置工作负载身份池和提供程序。
  3. 为额外的工作负载创建一个新的服务账号并分配相同的角色。

Dead Ends

Common approaches that don't work:

  1. 70% fail

    The limit is per service account, not a global quota; deleting keys frees slots but recreating without cleanup still hits the limit if you exceed 10.

  2. 60% fail

    Reusing keys increases security risk and doesn't solve the underlying quota issue; you still need separate keys for different workloads.

  3. 90% fail

    This limit is not adjustable via quota increase requests; it's a hard platform limit that cannot be changed.