在创建 GKE 集群时启用自动缩放

Enable autoscaling on GKE cluster creation

我尝试在 GKE 上创建一个自动缩放的容器集群。 当我使用“--enable-autoscaling”选项时(如此处的文档所示:https://cloud.google.com/container-engine/docs/clusters/operations#create_a_cluster_with_autoscaling):

$ gcloud container clusters create mycluster --zone $GOOGLE_ZONE --num-nodes=3 --enable-autoscaling --min-nodes=2 --max-nodes=5

但 MIG(托管实例组)未显示为 'autoscaled',如 Web 界面和以下命令的结果所示:

$ gcloud compute instance-groups managed list
NAME             SIZE   TARGET_SIZE   AUTOSCALED
gke-mycluster... 3      3             no

为什么?

然后,我尝试了 kubernetes 文档中指出的另一种方式 (http://kubernetes.io/docs/admin/cluster-management/#cluster-autoscaling),但显然出现了由“=true”引起的错误:

$ gcloud container clusters create mytestcluster --zone=$GOOGLE_ZONE --enable-autoscaling=true --min-nodes=2 --max-nodes=5 --num-nodes=3
usage: gcloud container clusters update  NAME [optional flags]
ERROR: (gcloud.container.clusters.update) argument --enable-autoscaling: ignored explicit argument 'true'

文档有错吗? 这是我的 gcloud 版本结果:

$ gcloud version
Google Cloud SDK 120.0.0
beta 2016.01.12
bq 2.0.24
bq-nix 2.0.24
core 2016.07.29
core-nix 2016.03.28
gcloud 
gsutil 4.20
gsutil-nix 4.18
kubectl 
kubectl-linux-x86_64 1.3.3

最后精度:自动缩放器在集群的描述中似乎 'on':

$ gcloud container clusters describe  mycluster | grep auto -A 3
- autoscaling:
    enabled: true
    maxNodeCount: 5
    minNodeCount: 2

有什么想法可以解释这种行为吗?

Kubernetes 集群自动缩放不使用托管实例组自动缩放器。它在 Kubernetes master 上运行一个 cluster-autoscaler 控制器,该控制器使用 Kubernetes 特定的信号来扩展您的节点。如果您需要更多信息,The codeautoscaler 存储库中。

我还发送了 a PR 来修复自动缩放文档中的无效标志用法。感谢您收听!