• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. User Guide 2.0
  4. Add-on Management
  5. autoscaler

autoscaler

This add-on is used for automatically resizing a Kubernetes cluster.

Introduction to the Add-on

The autoscaler add-on is used to automatically add or remove nodes in a cluster based on the pod scheduling status and resource usage.

  • If the pods in a cluster fail to be scheduled due to insufficient resources, the auto scale-up operation is automatically performed. Currently, the add-on uses the minimum waste policy. If three cores are required for creating a pod and there are four-core and eight-core nodes, a four-core node is preferentially created.
  • If a node in a cluster is not fully used for a period of time and the pod on the node can be scheduled to another node, the scale-down operation is automatically performed (that is, the node is automatically deleted).

Constraints

  • Only clusters of Kubernetes v1.11 support autoscaler.
  • This function is not compatible with the auto scaling policy related to CPU usage.

Installing the Add-on

  1. Log in to the CCE console. In the navigation pane, choose Add-on Management. On the Add-ons tab page, click Install Add-on under autoscaler.
  2. On the Configure Basic Information page, select the cluster and the add-on version, and click Next.
  3. Set the add-on installation parameters by referring to Table 1.

    Table 1 Add-on installation description

    Parameter

    Description

    Add-on Specifications

    • Single: Single-instance deployment.
    • HA: Multi-instance deployment for higher availability. This mode requires more compute resources.

    Login Mode

    Select a login mode for the node to be added for auto scale-out. Currently, the key pair mode is supported.

    Key Pair

    Key pair for logging in to the node to be added.

    Select an existing key pair and use it to log in to the node as the root user.

    Auto Scale-Down

    Indicates whether to enable cluster scale-down. If this function is enabled, the cluster automatically scales down or up when the following conditions are met:

    • Cluster scale-up: If a pod fails to be scheduled due to lack of resources, cluster scale-up is triggered. The quota of the added node is the same as that of other nodes in the group.
    • Cluster scale-down: If a cluster node is idle for a period of time (10 minutes by default), cluster scale-down is triggered, and the idle node is deleted. When a node is in one of the following states, it cannot be deleted:
      • A pod on the node has PodDisruptionBudget enabled. If certain conditions are not met, the node will not be deleted.
      • When local storage is configured for the pod, the node will not be deleted.
      • Due to some restrictions, such as affinity and anti-affinity, the pod cannot be scheduled to another node. In this case, the node will not be deleted.
      • If the pod has the "cluster-autoscaler.kubernetes.io/safe-to-evict": "false" annotations, the node will not be deleted.
      • A pod in the kube-system namespace (except for pods created by daemonset) exists on the node.
      • A pod created by a non-controller (deployment/replica set/job/stateful set) exists on the node.

    Pre-Deletion Idle Time (min)

    Time for which a node should keep in unneeded state before it is eligible for scale-down. The default value is 10 minutes.

    Scale-Down Threshold (%)

    Threshold for deleting a node. If the percentage of resource usage on a node is less than this threshold, auto scale-in will be triggered. The default value is 0.5.

    Total Nodes

    Maximum number of nodes in the cluster.

    Total Cores

    Maximum number of vCPUs in the cluster.

    Total Memory (GB)

    Maximum amount of memory in the cluster.

    Node Pool Configuration

    Default resource group. During cluster scale-down, if no other group is available, the resource specifications of the default group are used for added nodes.

    • AZ: A physical region where resources use independent power supply and networks.
    • OS: Operating system (OS) of the nodes to be created.
    • Node Specifications: CPU and memory specifications.
    • Taints: Taints are used to configure anti-affinity between nodes and pods. You can add a maximum of 10 taints for each node pool. Each taint contains the following parameters:
      • Key: A key must start with a letter or digit and can contain a maximum of 63 characters, including letters, digits, hyphens (-), underscores (_), and dots (.). A DNS subdomain can be used as the prefix of a key, for example, example.com/my-app. The DNS subdomain can contain a maximum of 253 characters.
      • Value: A value must start with a letter or digit and can contain a maximum of 63 characters, including letters, digits, hyphens (-), underscores (_), and dots (.).
      • Effect: Available options are NoSchedule, PreferNoSchedule, and NoExecute.
      NOTICE:

      By default, Taints are left empty. If taints are used, you must configure tolerations in the YMAL files of pods. Otherwise, the capacity expansion may fail or pods cannot be scheduled to added nodes.

  4. When the configuration is complete, click Install.

    After the installation is complete, you can view a running instance of the add-on on the Add-on Instances tab page. This indicates that the add-on has been installed in the selected cluster.

Uninstalling the Add-on

  1. Log in to the CCE console. In the navigation pane, choose Add-on Management. On the Add-on Instances tab page, click Uninstall under autoscaler.
  2. In the dialog box that is displayed, click OK to uninstall the add-on.