Google-Cloud-Platform

使用 gcloud 創建區域節點池時。節點未註冊

  • May 15, 2018

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 的錯誤?

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[*]}")(沒有尾隨逗號),現在可以使用

引用自:https://serverfault.com/questions/905147