在我现有的GKE集群上运行以下gcloud
命令时
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有错误吗?
答案 0 :(得分:0)
我重现了你的情况,但看起来这不是GKE问题。
我认为问题出现在$(printf ",%s" "${SCOPES[@]}")
函数中,该函数从逗号开始创建列表,并以某种方式影响可用范围。
我还发现https://www.googleapis.com/auth/cloud_debugger
不在node-pools create
命令的可用范围的list中。但是,基于云调试器documentation,您可以使用cloud-platform
范围而不是cloud_debugger
,一切都会正常。
所以,我用手动添加的范围检查了命令,它运行正常:
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 logging-write,monitoring-write,service-management,compute-rw,storage-rw,monitoring,pubsub,service-acontrol,service-management,sql-admin,trace,cloud-platform