Resizing a Container Cluster

This page explains how to resize container clusters. You can resize a container cluster to increase or decrease the number of nodes in that cluster.

Resizing a container cluster

Console

To resize your cluster's node pools, perform the following steps:

  1. Visit the Kubernetes Engine menu in GCP Console.

    Visit the Kubernetes Engine menu

  2. Select the desired cluster.

  3. Click Edit.
  4. From the Node pools menu, change the value of the Current size field to the desired value. Repeat for each node pool as needed.
  5. Click Save.

gcloud

To resize your cluster's node pools, you use the gcloud container clusters resize command. You must specify the cluster's name, the name of the desired node pool, and the new number of nodes:

gcloud container clusters resize [CLUSTER-NAME] --node-pool=[NODE-POOL] --size=[SIZE] [--zone=[COMPUTE-ZONE]] [--project=[PROJECT-ID]]

Repeat this command for each node pool. If your cluster only has its default node pool, omit the --node-pool flag.

For more information, refer to the gcloud container clusters resize documentation.

Increasing the size of your cluster

When you increase the size of a cluster:

  • New node instances are created using the same configuration as the existing instances
  • New Pods may be scheduled onto the new instances
  • Existing Pods are not moved onto the new instances

When you increase the size of a node pool that spans multiple zones, the new size represents the number of nodes in the node pool per zone. For example, if you have a node pool of size 2 spanning two zones, the total node count is 4. If you resize the node pool to size 4, the total node count becomes 8.

Decreasing the size of your cluster

When you decrease the size of a cluster:

  • The Pods that are scheduled on the instances being removed are killed
  • Pods managed by a replication controller are rescheduled by the controller onto the remaining instances
  • Pods not managed by a replication controller are not restarted

The managed instance group does not differentiate between instances running Pods and instances without Pods. Resizing down removes instances at random.

Decreasing the size of your cluster with drain

You can decrease the size of your cluster and have such instance's Pods be drained before they are removed.

To decrease and drain your cluster, run the following command:

gcloud beta container clusters resize [CLUSTER_NAME] --node-pool [NODE_POOL] --size [SIZE]

Autoscaling a container cluster

Kubernetes Engine's cluster autoscaler feature automatically resizes your node pools in response to changing conditions, such as changes in your workloads and resource usage.

To learn more about how autoscaling works, refer to the Cluster Autoscaler documentation.

What's next

Send feedback about...

Kubernetes Engine