Skip to content

Configure autoscaling for a node pool

View as Markdown

An autoscaling pool adds worker nodes when it needs them and removes them when it does not, always keeping between its Min Nodes and Max Nodes. An autoscaling pool is billed by the minute, and it can use every family except GDC 3rd generation.

You choose autoscaling in the pool’s drawer when you add a pool, on the create form or with Add Node Pool on a running cluster; see Manage node pools. A static pool stays static, so to autoscale next to it, add an autoscaling pool beside it.

  • For a pool on a running cluster, the cluster reads Running.
  • If you are a team member, your role has the update permission for Kubernetes.

In the pool’s drawer, choose a Scaling Strategy:

  • Elastic adds and removes nodes as a metric goes up and down: the nodes’ CPU use, or a custom metric you send. Take it when load changes in ways you cannot predict.
  • Scheduled scales to set node counts at set times. Take it when you know your busy hours.
  • Hybrid does both: it follows the schedule and also reacts to the metric.

Set Min Nodes and Max Nodes; they start at 3 and 5. Running nodes never fall below the minimum, and a new pool starts at the minimum.

  • Min Nodes can be 2 to 20, or 1 to 20 on the GPU family.
  • Max Nodes can be up to 25, and must not be below Min Nodes. Otherwise the drawer says The maximum worker nodes must be greater than the desired worker nodes.

For Elastic or Hybrid, choose CPU as the Metric.

  • Scale Up (CPU %) is 30 to 99, and starts at 60.
  • Scale Down (CPU %) is 10 up to half the scale-up value. Changing the scale-up value sets scale-down to half of it.

The CPU percentage is the worker nodes’ CPU use as E2E measures it on the machines, as a share of their vCPUs, not the CPU that pods request. The pool adds one node when CPU use stays above the scale-up value, and removes one when it stays below the scale-down value, for the number of periods set in Watch Period, each Period Duration (sec) long. After a scaling action, it waits for the Cooldown (seconds) before scaling again.

  • Period Duration (sec) is 5 to 50, and starts at 10.
  • Watch Period is 2 to 10, and starts at 3.
  • Cooldown (seconds) is 150 to 300, and starts at 150.

With the starting values, CPU use must stay above 60% for three periods of 10 seconds, 30 seconds in all, before the pool adds a node. It then waits 150 seconds before it scales again.

To scale on a number your own system measures, such as queue length or requests per second, choose Custom as the Metric, and enter a Custom metric name such as REQUESTS. The name uses uppercase letters, digits, and single underscores, is at least 2 characters long, starts and ends with a letter or digit, and is not CPU or MEMORY. With a custom metric, Scale Up has no range, and Scale Down is 1 up to half the scale-up value. The watch period, period duration, and cooldown work as they do for CPU.

A custom metric starts at 0, and you set its value yourself. Once the cluster reads Running:

  1. On the cluster’s Node Pool tab, open the pool and click Get cURL. It shows a command and the metric’s current value.
  2. Copy the command, and fill in your API key, your project ID, and your auth token from the API section of MyAccount.
  3. Set the metric’s value in the command, and run it. Run it again whenever the value changes, from a script or a cron job.

The command changes only the metric’s value, not the pool’s other settings.

For Scheduled or Hybrid, set an Upscale Recurrence and a Downscale Recurrence. Each is a cron expression with a Cardinality, the node count to scale to, which must be between Min Nodes and Max Nodes. The two expressions must differ, or the drawer says Recurrences should be different.

The drawer suggests cron examples and, once an expression is valid, shows its schedule in words. For example, to scale up at 09:00 and down at 20:00 on weekdays:

Upscale Recurrence: 0 9 * * 1-5
Downscale Recurrence: 0 20 * * 1-5

Read the schedule the drawer spells out to check the times before you add the pool.

  1. On the cluster’s Node Pool tab, on the pool’s panel, click Edit Node Pool. It is available while the pool reads Running.
  2. Change the strategy (Elastic, Scheduled, or Hybrid), Min Nodes, Max Nodes, or the policy values. Set the minimum at or below the number of nodes running now.
  3. Save your changes. Node pool policy edited successfully. confirms them.

To change the plan or go back to static, add a pool with the plan you want, then delete this one; see Manage node pools.

Open the pool on the Node Pool tab. It shows Minimum Workers, Maximum Workers, its elastic policy, and its scheduled policy, as you set them.

Your pool now scales on its own. To add nodes by hand, see Manage node pools. If the pool does not scale as you expect, see Troubleshooting Kubernetes.