Enable autoscaling on GKE cluster creation

9/12/2016

I try to create an autoscaled container cluster on GKE. When I use the "--enable-autoscaling" option (like the documentation indicates here : 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

but the MIG (Managed Instanced Group) is not displayed as 'autoscaled' as shown by both the web interface and the result of the following command :

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

Why ?

Then, I tried the other way indicated in the kubernetes docs (http://kubernetes.io/docs/admin/cluster-management/#cluster-autoscaling) but got an error caused by the '=true' apparently :

$ 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'

Is the doc wrong on this ? Here is my gcloud version results :

$ 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

Last precision : the autoscaler seems 'on' in the description on the cluster :

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

Any idea to explain this behaviour please ?

-- gdupin
autoscaling
google-cloud-platform
google-compute-engine
google-kubernetes-engine
kubernetes

1 Answer

9/12/2016

Kubernetes cluster autoscaling does not use the Managed Instance Group autoscaler. It runs a cluster-autoscaler controller on the Kubernetes master that uses Kubernetes-specific signals to scale your nodes. The code is in the autoscaler repo if you want more info.

I've also sent out a PR to fix the invalid flag usage in the autoscaling docs. Thanks for catching that!

-- CJ Cullen
Source: StackOverflow