Resize a Standard cluster by adding or removing nodes (original) (raw)

Resize a Standard cluster by adding or removing nodes

Stay organized with collections Save and categorize content based on your preferences.


This page explains how to manually resize Google Kubernetes Engine (GKE) Standard clusters. You can resize a cluster to increase or decrease the number of nodes in that cluster. Alternatively, you can autoscaleyour cluster, where GKE automatically resizes your node pools in response to changing conditions, such as changes in your workloads and resource usage.

These instructions don't apply to GKEAutopilotclusters, which automatically resize based on the number of Pods in the cluster.

When you add or remove nodes in your cluster, GKE adds or removes the associated virtual machine (VM) instances from the underlying Compute Engine Managed Instance Groups (MIGs) provisioned for your node pools. For removing nodes, do not use kubectl delete node as this does not delete the Compute Engine VM instance in the node pool's underlying MIG. Use cluster autoscaler or manually decrease the size of your cluster.

Before you begin

Before you start, make sure you have performed the following tasks:

Increase the size of your cluster

When you increase the size of a cluster, the following changes occur:

gcloud

To increase the size of a cluster's node pools, run the gcloud container clusters resize command:

gcloud container clusters resize CLUSTER_NAME --node-pool POOL_NAME
--num-nodes NUM_NODES

Replace the following:

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

Console

To increase the size of a cluster's node pools, perform the following steps:

  1. Go to the Google Kubernetes Engine page in the Google Cloud console.
    Go to Google Kubernetes Engine
  2. Beside the cluster you want to edit, click Actions, then click Edit.
  3. Click the Nodes tab next to the Details tab.
  4. In the Node Pools section, click the name of the node pool that you want to increase in size.
  5. Click Resize.
  6. In the Number of nodes field, enter how many nodes that you want in the node pool, and then click Resize.
  7. Repeat for each node pool as needed.

Decrease the size of your cluster

When you decrease the size of a cluster, the following changes occur:

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

To learn how to add node pools and to manage existing ones, refer toAdding and managing node pools.

gcloud

To decrease the size of a cluster's node pools, run the gcloud container clusters resize command:

gcloud container clusters resize CLUSTER_NAME --node-pool POOL_NAME
--num-nodes NUM_NODES

Replace the following:

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

Console

To decrease the size of a cluster's node pools, perform the following steps:

  1. Go to the Google Kubernetes Engine page in the Google Cloud console.
    Go to Google Kubernetes Engine
  2. Beside the cluster you want to edit, click Actions, then click Edit.
  3. Click the Nodes tab next to the Details tab.
  4. In the Node Pools section, click the name of the node pool that you want to decrease in size.
  5. Click Resize.
  6. In the Number of nodes field, enter how many nodes that you want in the node pool, and then click Resize.
  7. Repeat for each node pool as needed.

Autoscaling a cluster

GKE'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 autoscalerdocumentation. To set up autoscaling for your cluster, seeAutoscaling a cluster.

What's next