You can call the CreateAutoscalingConfig operation to configure auto scaling.
Debugging
Request syntax
POST /cluster/ClusterId/autoscale/config HTTP/1.1
Content-Type:application/json
{
"cool_down_duration" : "String",
"unneeded_duration" : "String",
"utilization_threshold" : "String",
"gpu_utilization_threshold" : "String",
"scan_interval" : "String",
"scale_down_enabled" : Boolean,
"expander" : "String",
"skip_nodes_with_system_pods" : Boolean,
"skip_nodes_with_local_storage" : Boolean,
"daemonset_eviction_for_nodes" : Boolean,
"max_graceful_termination_sec" : Integer,
"min_replica_count" : Integer,
"recycle_node_deletion_enabled" : Boolean,
"scale_up_from_zero" : Boolean
}Request parameters
Parameter | Type | Required | Example | Description |
ClusterId | String | Yes | cdde1f21ae22e483ebcb068a6eb7f**** | The ID of the cluster that you want to manage. |
Parameter | Type | Required | Example | Description |
cool_down_duration | String | No | 10 m | The waiting time before the auto scaling feature performs a scale-in activity. Only if the resource usage on a node remains below the scale-in threshold within the waiting time, the node is removed after the waiting time ends. Unit: minutes. |
unneeded_duration | String | No | 10 m | The cooldown period. Newly added nodes can be removed in scale-in activities only after the cooldown period ends. Unit: minutes. |
utilization_threshold | String | No | 0.5 | The scale-in threshold. This threshold specifies the ratio of the resources that are requested by pods to the total resources on the node. |
gpu_utilization_threshold | String | No | 0.5 | The scale-in threshold of GPU utilization. This threshold specifies the ratio of the GPU resources that are requested by pods to the total GPU resources on the node. |
scan_interval | String | No | 30s | The interval at which the cluster is scanned and evaluated for scaling. Unit: seconds. |
scale_down_enabled | Boolean | No | true | Specifies whether to allow node scale-in activities. Valid values:
|
expander | String | No | least-waste | The node pool scale-out policy. Valid values:
|
skip_nodes_with_system_pods | Boolean | No | true | Specifies whether to allow the cluster autoscaler to scale in nodes that host pods in the kube-system namespace, excluding DaemonSet pods and mirror pods. Valid values:
|
skip_nodes_with_local_storage | Boolean | No | false | Specifies whether to allow the cluster autoscaler to scale in nodes that host pods mounted with local storage (such as EmptyDir volumes or HostPath volumes). Valid values:
|
daemonset_eviction_for_nodes | Boolean | No | false | Specifies whether to evict DaemonSet pods during scale-in activities. Valid values:
|
max_graceful_termination_sec | Integer | No | 14400s | The maximum amount of time that the cluster autoscaler waits for pods on the nodes to terminate during scale-in activities. Unit: seconds. |
min_replica_count | Integer | No | 0 | The minimum number of pods that must be guaranteed during scale-in activities. |
recycle_node_deletion_enabled | Boolean | No | false | Specifies whether to delete the corresponding Kubernetes node objects after nodes are removed in swift mode. |
scale_up_from_zero | Boolean | No | true | Specifies whether the cluster autoscaler performs scale-out activities when the number of ready nodes in the cluster is zero. |
Response syntax
HTTP/1.1 200 OKResponse parameters
Configure auto scaling
Examples
POST /cluster/cdde1f21ae22e483ebcb068a6eb7f****/autoscale/config HTTP/1.1
Host:cs.aliyuncs.com
Content-Type:application/json
{
"cool_down_duration" : "10",
"unneeded_duration" : "10",
"utilization_threshold" : "0.5",
"gpu_utilization_threshold" : "0.5",
"scan_interval" : "30",
"scale_down_enabled" : true,
"expander" : "least-waste",
"skip_nodes_with_system_pods" : true,
"skip_nodes_with_local_storage" : false,
"daemonset_eviction_for_nodes" : false,
"max_graceful_termination_sec" : 14400,
"min_replica_count" : 0,
"recycle_node_deletion_enabled" : false,
"scale_up_from_zero" : true
}Sample success responses
JSON format
HTTP/1.1 200 OKError codes
For a list of error codes, see Service error codes.