Skip to main content

Can the autoscaler prefer one location or machine type and fall back?

Syself support For release

Yes. The Cluster Autoscaler priority expander does this: you give each node pool a priority, and the autoscaler grows the pool with the highest priority first and falls back to the next one when that pool cannot grow. This helps when Hetzner has no capacity for a server type in one location.

You set it up in your cluster, where the autoscaler runs. Start the Cluster Autoscaler with the priority expander and put the priorities into a ConfigMap named cluster-autoscaler-priority-expander in the autoscaler's namespace. Each entry is a regular expression that is matched against the name of a node group, and higher numbers win.

A node group is one of your worker pools. Its name contains the cluster name and the pool name from your Cluster object, so name the pools after what you want to match, for example the location or the server type. End the list with a catch-all entry at the lowest priority, so every autoscaled pool matches.

Follow Autoscale node pools to install the autoscaler and to set the minimum and maximum size of each pool. The expander is one of the Helm values in that installation. For the format of the ConfigMap, use the priority expander documentation⁠ of the Cluster Autoscaler project.

Before you rely on it:

  • The fallback takes time. The autoscaler moves to the next pool when the preferred one is at its maximum size, or when the nodes it requested have not joined within --max-node-provision-time, which is 15 minutes by default.
  • Pools with the same server type are balanced when balance-similar-node-groups is true, as in the installation in the docs. The autoscaler then spreads new nodes across those pools, also across locations. Set it to false when one location should fill first.

If the autoscaler adds no nodes at all, see Why is the autoscaler not adding nodes?

Still stuck?

Prepare your case, then email us.