使用 gcloud 创建区域节点池时。节点不会注册

使用 gcloud 创建区域节点池时。节点不会注册

gcloud在我现有的 GKE 集群上运行以下命令时

SCOPES=(
https://www.googleapis.com/auth/compute
https://www.googleapis.com/auth/devstorage.read_write
https://www.googleapis.com/auth/monitoring.write
https://www.googleapis.com/auth/logging.write
https://www.googleapis.com/auth/monitoring
https://www.googleapis.com/auth/pubsub
https://www.googleapis.com/auth/servicecontrol
https://www.googleapis.com/auth/service.management
https://www.googleapis.com/auth/sqlservice.admin
https://www.googleapis.com/auth/trace.append
https://www.googleapis.com/auth/cloud_debugger
https://www.googleapis.com/auth/cloud-platform
)

gcloud beta container node-pools create $POOL_NAME \
--machine-type $MACHINE_TYPE \
--disk-size $DISK_SIZE \
--enable-autorepair \
--enable-autoscaling \
--min-nodes 1 --max-nodes 4 \
--cluster $CLUSTER \
--zone $ZONE \
--num-nodes 1 \
--scopes $(printf ",%s" "${SCOPES[@]}")

(请注意,这是区域性的,因此使用 beta 命令 - 我怀疑这不会发生在非区域集群中)我收到以下错误:

    Creating node pool pool-alpha...done.                                                                                                                                                                                                         
ERROR: (gcloud.beta.container.node-pools.create) Operation [<Operation
 endTime: u'2018-03-29T08:56:14.989660264Z'
 name: u'operation-1522311735033-87b12027'
 operationType: OperationTypeValueValuesEnum(CREATE_NODE_POOL, 7)
 selfLink: u'https://container.googleapis.com/v1beta1/projects/xxxxxxxxx/zones/europe-west1-d/operations/operation-1522311735033-87b12027'
 startTime: u'2018-03-29T08:22:15.03391313Z'
 status: StatusValueValuesEnum(DONE, 3)
 statusMessage: u'All cluster resources were brought up, but the cluster API is reporting that only 0 nodes out of 3 have registered. Cluster may be unhealthy.'
 targetLink: u'https://container.googleapis.com/v1beta1/projects/xxxxxxxxxx/zones/europe-west1-d/clusters/digibet-prod/nodePools/pool-alpha'
 zone: u'europe-west1-d'>] finished with error: All cluster resources were brought up, but the cluster API is reporting that only 0 nodes out of 3 have registered. Cluster may be unhealthy.

确实,节点已创建但未在集群上注册。GKE 有错误吗?

答案1

Anton Kostenko 在 StackOverflow 上给出了答案:

https://stackoverflow.com/questions/49667351/when-creating-a-node-pool-multi-zone-with-gcloud-the-nodes-do-not-register-on

我的这行代码有问题--scopes $(printf ",%s" "${SCOPES[@]}"),在末尾多加了一个逗号,而这个逗号(有点可以理解)在 gcloud cli 上没有得到验证,并且破坏了一些内部 GKE 节点注册过程

我将其改为--scopes $(IFS=','; echo "${SCOPES[*]}")(没有尾随逗号),现在它可以工作了

相关内容