gcloud container clusters resize Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud container clusters resize - resizes an existing cluster for running containers
- SYNOPSIS
gcloud container clusters resizeNAME(--num-nodes=NUM_NODES|--size=NUM_NODES)[--async][--node-pool=NODE_POOL][--location=LOCATION|--region=REGION|--zone=ZONE,-zZONE][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
- Resize an existing cluster to a provided size.
If you have multiple node pools, you must specify which node pool to resize byusing the --node-pool flag. You are not required to use the flag if you have asingle node pool.
When increasing the size of a container cluster, the new instances are createdwith the same configuration as the existing instances. Existing pods are notmoved onto the new instances, but new pods (such as those created by resizing areplication controller) will be scheduled onto the new instances.
When decreasing a cluster, the nodes are drained. As a result, the pods runningon these nodes are gracefully terminated. If your pods are being managed by aworkload controller, the controller will attempt to reschedule them onto theremaining instances. If your pods are not managed by a workload controller, theywill not be restarted. Note that when resizing down, instances running pods andinstances without pods are not differentiated. Resize will pick instances toremove at random.
When you resize a node pool that spans multiple zones, the new size representsthe number of nodes in the node pool per zone. For example, if you have a nodepool of size 2 spanning two zones, the total node count is 4. If you resize thenode pool with
--num-nodes=4, the total node count becomes 8. - EXAMPLES
- To resize the default node pool of an existing cluster, run:
gcloudcontainerclustersresizesample-cluster--num-nodes=2 - POSITIONAL ARGUMENTS
NAME- The name of this cluster.
- REQUIRED FLAGS
- Exactly one of these must be specified:
--num-nodes=NUM_NODES- Target number of nodes in the cluster.
--size=NUM_NODES- (DEPRECATED) Target number of nodes in the cluster.
The --size flag is now deprecated. Please use
--num-nodesinstead.
- Exactly one of these must be specified:
- OPTIONAL FLAGS
--async- Return immediately, without waiting for the operation in progress to complete.
--node-pool=NODE_POOL- The node pool to resize.
- At most one of these can be specified:
--location=LOCATION- Compute zone or region (e.g. us-central1-a or us-central1) for the cluster.Overrides the default compute/region or compute/zone value for this commandinvocation. Prefer using this flag over the --region or --zone flags.
--region=REGION- Compute region (e.g. us-central1) for a regional cluster. Overrides the defaultcompute/region property value for this command invocation.
--zone=ZONE,-zZONE- Compute zone (e.g. us-central1-a) for a zonal cluster. Overrides the defaultcompute/zone property value for this command invocation.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$gcloud helpfor details. - NOTES
- These variants are also available:
gcloudalphacontainerclustersresizegcloudbetacontainerclustersresize
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-05-07 UTC.