All Products
Search
Document Center

Container Service for Kubernetes:CreateAutoscalingConfig

Last Updated:Nov 07, 2024

Creates a scaling configuration to allow the system to scale resources based on the given scaling rules. When you create a scaling configuration, you can specify the scaling metrics, thresholds, scaling order, and scaling interval.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cs:CreateAutoscalingConfigcreate
  • Cluster
    acs:cs:{#regionId}:{#accountId}:cluster/{#ClusterId}
    none
none

Request syntax

POST /cluster/{ClusterId}/autoscale/config/ HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
ClusterIdstringYes

The cluster ID.

c0XXXXXXX10
bodyobjectNo

The request body.

cool_down_durationstringNo

The waiting time before the auto scaling feature performs a scale-in activity. It is an interval between the time when the scale-in threshold is reached and the time when the scale-in activity (reduce the number of pods) starts. Unit: minutes. Default value: 10.

10 m
unneeded_durationstringNo

The cooldown period. After the autoscaler performs a scale-out activity, the autoscaler waits a cooldown period before it can perform a scale-in activity. Newly added nodes can be removed in scale-in activities only after the cooldown period ends. Unit: minutes.

10 m
utilization_thresholdstringNo

The scale-in threshold. This threshold specifies the ratio of the resources that are requested by pods to the total resources on the node.

A scale-in activity is performed only when the CPU utilization and memory utilization of a node are lower than the scale-in threshold.

0.5
gpu_utilization_thresholdstringNo

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.

A scale-in activity is performed only when the CPU utilization, memory utilization, and GPU utilization of a GPU-accelerated node are lower than the scale-in threshold of GPU utilization.

0.5
scan_intervalstringNo

The interval at which the system scans for events that trigger scaling activities. Unit: seconds. Default value: 60.

30s
scale_down_enabledbooleanNo

Specifies whether to allow node scale-in activities. Valid values:

  • true: allows node scale-in activities.
  • false: does not allow node scale-in activities.
true
expanderstringNo

The node pool scale-out policy. Valid values:

  • least-waste: the default policy. If multiple node pools meet the requirement, this policy selects the node pool that will have the least idle resources after the scale-out activity is completed.
  • random: the random policy. If multiple node pools meet the requirement, this policy selects a random node pool for the scale-out activity.
  • priority: the priority-based policy If multiple node pools meet the requirement, this policy selects the node pool with the highest priority for the scale-out activity. The priority setting is stored in the ConfigMap named cluster-autoscaler-priority-expander in the kube-system namespace. When a scale-out activity is triggered, the policy obtains the node pool priorities from the ConfigMap based on the node pool IDs and then selects the node pool with the highest priority for the scale-out activity.
least-waste
skip_nodes_with_system_podsbooleanNo

Specifies whether the cluster autoscaler scales in nodes that host pods in the kube-system namespace. This parameter does not take effect on pods created by DaemonSets and mirror pods. Valid values:

  • true: does not allow the cluster autoscaler to scale in these nodes.
  • false: allows the cluster autoscaler to scale in these nodes.
true
skip_nodes_with_local_storagebooleanNo

Specifies whether the cluster autoscaler scales in nodes that host pods mounted with local volumes, such as EmptyDir or HostPath volumes. Valid values:

  • true: does not allow the cluster autoscaler to scale in these nodes.
  • false: allows the cluster autoscaler to scale in these nodes.
false
daemonset_eviction_for_nodesbooleanNo

Specifies whether to evict pods created by DaemonSets when the cluster autoscaler performs a scale-in activity. Valid values:

  • true: evicts DaemonSet pods.
  • false: does not evict DaemonSet pods.
false
max_graceful_termination_secintegerNo

The maximum amount of time to wait for pods on a node to terminate during a scale-in activity. Unit: seconds.

14400s
min_replica_countintegerNo

The minimum number of pods allowed in each ReplicaSet before a scale-in activity is performed.

0
recycle_node_deletion_enabledbooleanNo

Specifies whether to delete the corresponding Kubernetes node objects after nodes are removed in swift mode. For more information about the swift mode, see Scaling mode. Default value: false. Valid values:

  • true: deletes the corresponding Kubernetes node objects after nodes are removed in swift mode. We recommend that you do not set the value to true because data inconsistency may occur in Kubernetes objects.
  • false: retains the corresponding Kubernetes node objects after nodes are removed in swift mode.
false
scale_up_from_zerobooleanNo

Specifies whether the cluster autoscaler performs a scale-out activity when the number of ready nodes in the cluster is 0. Default value: true. Valid values:

  • true: performs a scale-out activity.
  • false: does not perform a scale-out activity.
true

Response parameters

ParameterTypeDescriptionExample
The current API has no return parameters

Examples

Sample success responses

JSONformat

{}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-06-02The internal configuration of the API is changed, but the call is not affectedView Change Details