【问题标题】:GKE autopilot cluster creation failureGKE 自动驾驶集群创建失败
【发布时间】:2022-06-23 23:58:02
【问题描述】:

我正在尝试在 GCP 中使用 terraform 创建 composer 环境,我可以看到它在一个项目中失败,同时在自动驾驶模式下创建 Kubernetes 集群;它在我们以相同方式部署的其他 2 个项目中运行良好。

所以我也尝试以手动方式创建自动驾驶 kubernetes 集群,但我们无法跟踪它的问题,因为它仅显示以下错误:

k8s cluster creation error

从命令行尝试时出错:

gcloud container clusters create-auto test \
    --region europe-west2 \
    --project=project-id 

注意:Pod 地址范围限制了集群的最大大小。请参考https://cloud.google.com/kubernetes-engine/docs/how-to/flexible-pod-cidr 了解如何优化 IP 地址分配。 在 europe-west2 中创建集群测试...正在部署集群...完成。

ERROR: (gcloud.container.clusters.create-auto) Operation [<Operation
 clusterConditions: [<StatusCondition
 canonicalCode: CanonicalCodeValueValuesEnum(UNKNOWN, 2)
 message: 'Failed to create cluster'>]
 detail: 'Failed to create cluster'
 endTime: '2022-05-31T20:00:07.8398558Z'
 error: <Status
 code: 2
 details: []
 message: 'Failed to create cluster'>
 name: 'operation-1654027061293-a14298fa'
 nodepoolConditions: []
 operationType: OperationTypeValueValuesEnum(CREATE_CLUSTER, 1)
 progress: <OperationProgress
 metrics: [<Metric
 intValue: 12
 name: 'CLUSTER_CONFIGURING'>, <Metric
 intValue: 12
 name: 'CLUSTER_CONFIGURING_TOTAL'>, <Metric
 intValue: 9
 name: 'CLUSTER_DEPLOYING'>, <Metric
 intValue: 9
 name: 'CLUSTER_DEPLOYING_TOTAL'>]
 stages: []>
 selfLink: 'https://container.googleapis.com/v1/projects/projectid/locations/europe-west2/operations/operation-1654027061293-a14298fa'
 startTime: '2022-05-31T19:57:41.293067757Z'
 status: StatusValueValuesEnum(DONE, 3)
 statusMessage: 'Failed to create cluster'
 targetLink: 'https://container.googleapis.com/v1/projects/projectid/locations/europe-west2/clusters/test'
 zone: 'europe-west2'>] finished with error: Failed to create cluster

【问题讨论】:

  • 日志说什么?你是如何创建集群的?你能分享你正在使用的 terraform 步骤吗?您遗漏了一些细节,这些细节可能让我们只是猜测而不是使用事实
  • 此外,图片并没有比你的问题多说,所以根本没有帮助
  • 我在日志部分没有得到任何信息,这对我来说太奇怪了;它与 terraform 脚本无关,仅与 kubernetes 集群创建有关,即使我尝试从默认网络中的命令行创建 kubernetes 集群也无法正常工作。
  • 愚蠢的问题,但是您是否在出现问题的项目中启用了 GKE API?
  • 是的,GKE API 已经启用,因为已经在标准模式下创建了两个运行良好的集群

标签: kubernetes google-kubernetes-engine terraform-provider-gcp


【解决方案1】:

服务帐号“service-xxxxxxxx@container-engine-robot.iam.gserviceaccount.com”需要角色 Kubernetes Engine Service Agent (roles/container.serviceAgent),导致 k8s 集群创建失败;授予权限后,我们就可以创建集群了

【讨论】:

    猜你喜欢
    • 2021-06-12
    • 2021-12-23
    • 2021-08-17
    • 2022-11-03
    • 2021-07-29
    • 1970-01-01
    • 2022-01-22
    • 2021-11-06
    • 1970-01-01
    相关资源
    最近更新 更多