This document explains how to resize container clusters using the
Increasing the size of a container cluster
When increasing the size of a container cluster, the new instances are created with the same configuration as the existing instances. Existing pods are not moved onto the new instances, but new pods (such as those created by resizing a replication controller) will be scheduled onto the new instances.
When resizing a node pool that spans across multiple zones, the size represents the number of nodes (in the node pool) per zone. e.g. If you have a node pool of size 2 spanning across us-central1-a and us-central1-b, the total node count will be 4. If you then resize it to size 4, the total node count will be 8.
To resize a container cluster, run the following command:
gcloud container clusters resize CLUSTER_NAME --size SIZE
If you have multiple node pools, you must specify which node pool to resize by
--node-pool flag. You are not required to use the flag if you have a
single node pool.
gcloud container clusters resize CLUSTER_NAME --node-pool NODE_POOL --size SIZE
Decreasing the size of a container cluster
When decreasing a cluster, the pods that are scheduled on the instances being removed will be killed. If your pods are being managed by a replication controller, the controller will attempt to reschedule them onto the remaining instances. If your pods are not managed by a replication controller, they will not restart.
Note that the managed instance group does not discern between instances running pods and instances without pods. Resizing down will pick instances to remove at random.
To decrease the size of a container cluster, follow the instructions in Increasing the size above.
To decrease the size of a container cluster with each instances's pods being drained before instance removal, run the following command:
gcloud beta container clusters resize CLUSTER_NAME --node-pool NODE_POOL --size SIZE
Cluster resize with drain will eventually become the default behavior for gcloud.
Warning: Do not use both Cluster Autoscalar and manual resize commands simultaneously on a node pool as this can cause interactions that result in unstable and/or incorrect node pool size.
Autoscaling a container cluster
Container Engine's Cluster Autoscaler feature can automatically resize your container cluster or node pools in response to changing conditions, such as changes in your workloads and resource usage. See the Cluster Autoscaler documentation for more information.