If your cluster has insufficient resources to schedule pods, you can use node autoscaling to automatically add or remove nodes. Node autoscaling is ideal for less demanding scaling scenarios, such as clusters with fewer than 20 autoscaled node pools or fewer than 100 nodes in each. It is also suitable for workloads with stable traffic, predictable resource demands, and where a single scaling action is sufficient.
Before you begin
To use the node autoscaling feature effectively, we recommend that you first read Node scaling and understand the following:
How node autoscaling works and its features
Use cases suitable for node autoscaling
Important considerations before using node autoscaling
During a scale-in, subscription instances are removed from the cluster but not terminated. To avoid extra costs, use pay-as-you-go instances when you enable this feature.
Precautions
-
Before you begin, make sure that you have activated the Auto Scaling service.
-
For information about quotas and limits, see the Precautions for node scaling.
-
Node autoscaling has known limitations with certain scheduling policies, which might lead to unexpected scaling behavior. If your workloads or components use an unsupported scheduling policy, we recommend one of the following solutions:
-
Solution 1: Switch to node instant scaling.
-
Solution 2: Deploy the affected workloads or components to a node pool where node scaling is not enabled.
For example, to deploy the ack-node-local-dns-admission-controller component, deploy it to a node pool where node scaling is not enabled and add the following node affinity requirement to the component's configuration.
nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: "k8s.aliyun.com" operator: "NotIn" values: ["true"]
-
-
The cluster-autoscaler component requires node resources during updates or deployments. Insufficient resources can cause these operations to fail and disrupt scaling. Ensure your nodes have adequate resources to prevent such failures.
This feature involves the following steps:
-
Step 1: Enable node autoscaling for the cluster: You must first enable node autoscaling at the cluster level for node pool auto scaling policies to take effect.
-
Step 2: Configure autoscaled node pools: The node autoscaling feature affects only node pools where it is enabled. Therefore, you must set the scaling mode of specific node pools to Auto.
Step 1: Enable node autoscaling
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
-
On the Node Pools page, next to Node Scaling, click Enable.
-
If this is your first time using node autoscaling, follow the on-screen instructions to activate the Auto Scaling service and grant the required permissions. If you have already done this, skip this step.
-
ACK managed cluster: Authorize the AliyunCSManagedAutoScalerRole role.
-
ACK dedicated cluster: Authorize the KubernetesWorkerRole role and attach the AliyunCSManagedAutoScalerRolePolicy.
In the Node Scaling Configuration dialog box, after the precheck passes, click the RAM role link (such as
KubernetesWorkerRole-xxxx) to complete authorization in the RAM console.
-
-
On the Node Scaling Configuration page, set Node Scaling Plan to Auto Scaling, configure the parameters, and then click OK.
You can switch the scaling solution after it is selected. To switch, change the selection to node instant scaling, read the on-screen prompts carefully, and follow the instructions to complete the operation.
Parameter
Description
Node Pool Scale-out Policy
-
Random Policy: If multiple node pools are eligible for scale-out, one is chosen at random.
-
Default Policy: If multiple node pools are eligible for scale-out, it chooses the one that results in the least resource waste.
-
Priority-based Policy: If multiple node pools are eligible for scale-out, it chooses the one with the highest priority.
Node pool priority is defined by the Node Pool Scale-out Priority parameter.
Node Pool Scale-out Priority
Sets the scale-out priority for node pools. This parameter takes effect only when Node Pool Scale-out Policy is set to Priority-based Policy.
Value range: an integer from 1 to 100. A larger value indicates a higher priority.
You must click Add next to the parameter, select an autoscaled node pool, and set a priority for it.
If no autoscaled node pools are available, you can ignore this parameter for now and set the priority after you complete Step 2: Configure autoscaled node pools.
Scaling Sensitivity
The interval at which the system checks whether to perform scaling. The default value is 60s.
During auto scaling, the scaling component automatically triggers scale-out events based on scheduling status.
Important-
ECS nodes: The scaling component can scale in a node only when the conditions for Scale-in Threshold, Scale-in Trigger Delay, and Cooldown Period are all met.
-
GPU nodes: The scaling component can scale in a GPU node only when the conditions for GPU Scale-in Threshold, Scale-in Trigger Delay, and Cooldown Period are all met.
Allow Scale-in
Specifies whether to allow node scale-in. If this is turned off, scale-in-related configurations do not take effect. Use this setting with caution.
Scale-in Threshold
The ratio of resource requests to the total resource capacity of a node in a node pool with node autoscaling enabled.
A node is eligible for scale-in only if its CPU and memory resource utilization are both below the Scale-in Threshold.
GPU Scale-in Threshold
The scale-in threshold for GPU instances.
A GPU instance is eligible for scale-in only when its CPU, memory, and GPU utilization all fall below the configured GPU Scale-in Threshold.
Scale-in Trigger Delay
The delay between when a node becomes eligible for scale-in and when the scale-in operation is performed. Unit: minutes. Default value: 10 minutes.
ImportantThe scaling component can perform a node scale-in only after the Scale-in Threshold condition is met and the Scale-in Trigger Delay duration has passed.
Cooldown Period
The period after the most recent scale-out event during which the scaling component will not perform a scale-in.
During the cooldown period, scale-in actions are paused, but the system continues to evaluate nodes for eligibility. Once the cooldown ends, any node that has met the scale-in conditions (threshold and deferral time) is scaled in. For example, with a 10-minute cooldown and a 5-minute deferral, no nodes are removed for 10 minutes after a scale-out. If a node becomes eligible at minute 2, it will be removed at minute 10, as it has been eligible for 8 minutes, which exceeds the 5-minute deferral.
-
Step 2: Configure autoscaled node pools
You can either configure an existing node pool by changing its Scaling Mode to Auto, or create a new node pool with auto scaling enabled.
For detailed instructions, see Create and manage a node pool. The key parameters are described below:
|
Parameter |
Description |
|
Scaling Mode |
|
|
Instances |
The scalable Min. Instances and Max. Instances in the node pool do not include your existing instances. Note
|
|
Instance-related parameters |
When scaling out, nodes are allocated from the configured ECS instance families. To improve scale-out success rates, select multiple instance types across multiple zones to avoid unavailability or insufficient inventory. The specific instance type used for scaling is determined by the configured Scaling Policy. To ensure business stability and accurate resource scheduling, do not mix GPU and non-GPU instance types in the same node pool. Configure instance types for scaling in one of two ways:
Refer to the console's elasticity strength recommendations for configuration, or view node pool elasticity strength after creation. For ACK-unsupported instance types and node configuration recommendations, see ECS instance type configuration recommendations. Cloud resource and billing information: |
|
Operating System |
For autoscaled nodes, Alibaba Cloud Linux, Windows, and Windows Core images are supported. When you select a Windows or Windows Core image, the system automatically adds the taint |
|
Node Labels |
Node labels added to the cluster configuration are automatically applied to nodes created during a scale-out. Important
Node autoscaling recognizes node labels and taints only after they are mapped to node pool tags, and there is a limit to the number of node pool tags. Therefore, for an autoscaled node pool, ensure that the total number of configured ECS tags, taints, and node labels does not exceed 12. |
|
scaling policy |
Configure how the node pool selects instances during scaling.
|
|
Use Pay-as-you-go Instances When Spot Instances Are Insufficient |
Requires selecting spot instances as the billing method. When enabled, if sufficient spot instances cannot be created due to price or inventory reasons, ACK automatically attempts to create pay-as-you-go instances as a supplement. Cloud resource and billing information: |
|
Enable Supplemental Spot Instance |
Requires selecting spot instances as the billing method. When enabled, upon receiving a system notification that a spot instance will be reclaimed (5 minutes before reclamation), ACK attempts to scale out new instances for compensation.
Active release of spot instances may cause business disruptions. To improve compensation success rates, we recommend also enabling Use Pay-as-you-go Instances When Spot Instances Are Insufficient. Cloud resource and billing information: |
|
Scaling Mode |
Requires enabling Auto Scaling for the node pool and setting Scaling Mode to Auto.
|
|
Taints |
Prevents pods from being scheduled to the node. |
Step 3: (Optional) Verify the result
After you complete these steps, the node autoscaling feature is ready to use. The node pool will indicate that auto scaling is active, and the system will automatically install the cluster-autoscaler component.
Auto scaling is enabled for the node pool
On the Node Pools page, the list of node pools shows the node pools for which auto scaling is enabled.
The cluster-autoscaler component is installed
In the left navigation pane of the cluster management page, choose .
-
Select the kube-system namespace. The cluster-autoscaler component appears in the list.
FAQ
Category | Subcategory | Link |
Scaling behavior of node auto scaling | ||
| ||
Does the cluster-autoscaler support CustomResourceDefinitions (CRDs)? | ||
Custom scaling behavior | ||
cluster-autoscaler component | ||