Autoscale node groups Stay organized with collections Save and categorize content based on your preferences.
If you usesole-tenant nodes for your workloads, you canautomatically manage the sizes of node groups by using the node groupautoscaler. You can configure autoscaling while creating a node group or aftercreating one.
The autoscaler can help you automatically manage the sizes of yoursole-tenant node groups by:
Increasing the size of a node group when there is insufficient capacity foranother virtual machine (VM) instance on that node group. After the autoscalerincreases the size of the node group, the VMs are scheduled transparently.
Decreasing the size of a node group when there are empty nodes, which preventsyou from paying for unused sole-tenant nodes.
While scaling a node group, the autoscaler considers the required capacity forthe VM being scheduled, the free capacity on the nodes it is targeting, andthe autoscaling policy of the node group. The required capacity is based onlyon the size of the VM. The free capacity is estimated based on the size of thenode, the VMs already scheduled on it, and the optionalCPU overcommit ratio.
The following diagram shows:
The node group autoscaler scaling out by adding a new node to a node group inresponse to the deployment of a VM to a node group with no empty nodes.
The node group autoscaler scaling by removing an empty node from asole-tenant node group.
Autoscaler modes
By default, the autoscaler is not enabled on node groups. When the autoscaler isnot enabled, you must manually manage the sizes of your node groups. If youenable the autoscaler on a node group, you can specify that the autoscaler bothincreases and decreases the size of the node group (scales out and scales in),or that it only increases the size of the group (only scales out).
Scale out and scale in
In this mode, the node group autoscaler both increases (scales out) anddecreases (scales in) the size of your node groups. For this mode, you mustspecify a maximum size and a minimum size for the node group. The autoscalerwon't scale the size of the node group above the specified maximum or belowthe specified minimum.
Scaling out is triggered when the scheduling for a VM fails due tolack of capacity. To resolve this issue, a new node is added to the group andthe operation is tried again.
Scaling in is triggered when a node remains empty for a period of time. An emptynode is a result of a VM being deleted or migrated out of the node group. If theautoscaling policy of the node group allows it, the empty node is scheduled forremoval after astabilization period. The stabilization period ensures thatthe node is still available if you need to use it.
Only scale out
With this mode, the autoscaler increases the size of the node group in responseto requests to schedule VMs, but doesn't remove empty nodes from node groups.Google recommends this mode for monotonically increasing workloads or workloadsthat require physical server affinity, such asBYOLworkloads, whichrequire licenses to reside on the same physical server.
You must use this mode if your node groups are configured with theMigratewithin node group maintenance policy.
Size range of a node group
When you enable the autoscaler, you set the size range of the node group byspecifying a minimum and maximum value for the node group size.
If you don't specify a value for the minimum size, the autoscaler sets theminimum size to zero (0). If you do a specify value for the minimum size, itmust be an integer greater than or equal to 0, and it must be less than or equalto the maximum size.
You must specify a value for the maximum size of the node group. The value mustbe an integer that is greater than or equal to 0 and less than or equal to 100,which is the maximum allowed size for a sole-tenant node group, and the valuemust be greater than or equal to the specified minimum value.
To accommodate workloads that might exceed the size maximum of 100 for a nodegroup, create multiple node groups with matching affinity labels, for example,workload:in:my-autoscaled-node-groups. Then, schedule VMs usingthat affinity label, and enable autoscaling on each group to create adynamically scaling group of node groups.
Availability
You can only use the sole-tenant node autoscaler inregions that support sole-tenant nodes.
Before you begin
- If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Enable the node group autoscaler
Configure autoscaling on a new node group.
gcloud
The example below shows how to use thenode-groupscreatecommand to enable the autoscaler when you are creating a node group. To addan autoscaler to an existing node group, use thenode-groupsupdatecommand.
gcloud compute sole-tenancy node-groups creategroup-name \ --node-templatetemplate-name \ --target-sizesize \ --maintenance-policymaintenance-policy \ --zonezone \ --autoscaler-modemode \ --max-nodesmax-nodes \ --min-nodesmin-nodes
Replace the following:
group-name: Name of the node group to create.template-name: Name of the node template fromwhich to create the node group.size: Target initial number of nodes in the nodegroup.maintenance-policy: Specifies if VMs migrate andif they are restarted during host maintenance events. Set it to one of thefollowing values:default: VMs live migrate to a new node.migrate-within-node-group: VMs live migrate to anothernode in the node group.restart-in-place: VMs restart on the same node after theyare terminated due to a maintenance event.
zone: Zone in which to create the node group.mode: Mode for the autoscaler on this node group.Set to one of the following values:off: Disables the autoscaler.on: Enables scaling in and scaling out.only-scale-out: Enables only scaling out. You must usethis mode if your node groups are configured to restart their hosted VMson minimal servers.
max-nodes: Maximum size of the node group. Set toa value less than or equal to 100 and greater than or equal tomin-nodes.min-nodes: Minimum size of the node group, andmust be an integer value less than or equal tomax-nodes. The default value is 0.
REST
The following example shows how to use thenodeGroups.insertcommand to enable the autoscaler when you are creating a node group. To addan autoscaler to an existing node group, use thenodeGroups.patchcommand.
POST https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/nodeGroups?initialNodeCount=initial-node-count { "name": "group-name", "nodeTemplate": "template-name", "autoscalingPolicy": { "mode": "mode", "min_nodes":min-nodes, "max_nodes":max-nodes } "maintenancePolicy":maintenance-policy }Replace the following:
project-id: ID of the project for which to add anode group with an autoscaler.zone: Zone in which to create the new node group.initial-node-count: Required when creating thenode group. This specifies the initial number of nodes in the node group. Ifthe value formin-nodesis greater than the initialnode count, the size of the node group is scaled out to the value ofmin-nodes.group-name: Name of the new node group.template-name: Name of the node template fromwhich to create the node group.mode: Mode for the autoscaler on this node group.Set to one of the following:OFF: Disables the autoscaler.ON: Enables scaling in and scaling out.ONLY_SCALE_OUT: Enables only scaling out. You must usethis mode if your node groups are configured to restart their hosted VMson minimal servers.
max-nodes: Maximum size of the node group. Set toa value less than or equal to 100 and greater than or equal tomin-nodes.min-nodes: Minimum size of the node group, andmust be an integer value less than or equal tomax-nodes.The default value is 0.maintenance-policy: Specifies if VMs migrate andif they are restarted during host maintenance events. Set this to one ofthe following values:DEFAULT: VMs live migrate to a new node.MIGRATE_WITHIN_NODE_GROUP: VMs live migrate to anothernode in the node group.RESTART_IN_PLACE: VMs restart on the same node after theyare terminated due to a maintenance event.
Update autoscaler settings
Change the autoscaler settings on a node group by updating the autoscaler modeor by updating the minimum and maximum size of the node group.
gcloud
The following example shows how to use thenode-groupsupdatecommand to change the mode of the autoscaler on a node group.
gcloud compute sole-tenancy node-groups updatename \ --autoscaler-modemode \ --max-nodesmax-nodes \ --min-nodesmin-nodes
Replace the following:
name: Name of the node group on which to changethe autoscaler mode.mode: Mode for the autoscaler on this node group.Set to one of the following:off: Disables the autoscaler.on: Enables scaling in and scaling out.only-scale-out: Enables only scaling out. You must usethis mode if your node groups are configured to restart their hostedVMs on minimal servers.
max-nodes: Maximum size of the node group. Set toa value less than or equal to 100 and greater than or equal tomin-nodes.min-nodes: Minimum size of the node group, andmust be an integer value less than or equal tomax-nodes.The default value is 0.
REST
The following example shows how to use thenodeGroups.patchcommand to change the mode of an autoscaler on a node group.
PATCH https://compute.googleapis.com/compute/beta/projects/project-id/zones/group-zone/nodeGroups/group-name{ "nodeTemplate": "template-name", "autoscalingPolicy": { "mode": "mode", "minSize":min-nodes, "maxSize":max-nodes }}Replace the following:
project-id: ID of the project containing the nodegroup for which to change the autoscaler mode.group-zone: Zone containing the node group forwhich to change the autoscaler mode.group-name: Name of the node group for which tochange the autoscaler mode.template-name: Name of the node template fromwhich the node group was created.mode: Mode for the autoscaler on this node group.Set to one of the following:OFF: Disables the autoscaler.ON: Enables scaling in and scaling out.ONLY_SCALE_OUT: Enables only scaling out. You must usethis mode if your node groups are configured with theMigrate withinnode group maintenance policy.
max-nodes: Maximum size of the node group. Set toa value less than or equal to 100 and greater than or equal tomin-nodes.min-nodes: Minimum size of the node group, andmust be an integer value less than or equal tomax-nodes.The default value is 0.
Manually update the size of autoscaled node groups
When the autoscaler is enabled, node group size is managed automatically, butyou can schedule or remove VMs on that node group to effectively manually updatethe group size.
To manually decrease the size of an autoscaled node group, delete VMs from thenode until the node is empty. When the node is empty, the autoscaler removes theempty node, which decreases the size of the node group.
To manually increase the size of an autoscaled node group, set the minimum sizeof the group to a value greater than the current size. When the minimum size ofa group is set to a value greater than the current size, the autoscaler scalesout the group size to the newly specified minimum size.
When node groups are set to only scale out, the autoscaler automatically managesincreases in group size and disables manual group size increases. With thissetting, you can decrease the size of a group by removing VMs from a node untilthat node is empty, and then you can remove the empty node.
Disable the autoscaler
When you no longer need to use the autoscaler to automatically manage the sizesof your node groups, or if you need to manually manage the sizes of your nodegroups, disable the autoscaler.
gcloud
gcloud compute sole-tenancy node-groups updatename \ --autoscaler-mode OFF
Replacename with the name of the nodegroup from which to remove the autoscaling policy.
REST
The following example shows how to use thenodeGroups.patchcommand to turn off an autoscaler on a node group.
PATCH https://compute.googleapis.com/compute/beta/projects/project-id/zones/group-zone/nodeGroups/group-name{ "nodeTemplate": "template-name", "autoscalingPolicy": { "mode": "mode" }}Replace the following:
project-id: ID of the project containing the nodegroup for which to change the autoscaler mode.group-zone: Zone containing the node group forwhich to change the autoscaler mode.group-name: Name of the node group for which tochange the autoscaler mode.template-name: Name of the node template fromwhich the node group was created.mode: Mode for the autoscaler on this node group.Set toOFFto disable the autoscaler on this node group.
View autoscaler activity
In the Google Cloud console, view the autoscaler adjusting the sizes of your nodegroups. The Google Cloud console shows the current size of the node group, andif the autoscaler is adjusting the size of group, you can also see the targetsize of the node group.
Console
In the Google Cloud console, go to theSole-tenant nodes page.
ClickNode groups.
View the number of nodes in each node group, and ifCompute Engine is scaling the node group, you can also view thetarget number of nodes.
What's next
- Learn aboutbringing images with existing licenses to Google Cloud.
- Learn about thecluster autoscaler.
- Learn about themanaged instance group autoscaler.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.