All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Configure auto scaling for a cluster

Last updated:2023-05-23 18:05:41

Cluster AutoScaler (CA) is an add-on that is used to automatically scale nodes of a Kubernetes cluster. When the capacity of a cluster is insufficient, CA automatically creates a new node by calling Cloud Provider. When the utilization of a node is lower than 50% for more than 10 minutes, CA deletes the node to reduce costs.

Scale-out condition

CA checks whether a cluster has sufficient resources to schedule newly created pods every 10 seconds. If resources are insufficient, CA calls Cloud Provider to create a new node. Whenever the Kubernetes scheduler cannot find a node to schedule a pod, the scheduler sets the PodCondition of the pod to false and the reason to unschedulable. CA checks for unschedulable pods at the specified interval. If an unschedulable pod exists, CA creates a node to schedule the pod.

Scale-out policy

If a cluster has more than one node pool, you can specify the policy for selecting the node pool to scale out. The following options are supported:

  • random: CA randomly selects a node pool.
  • most-pods: CA selects the node pool with the maximum capacity. This node pool has more resources to schedule pods.
  • least-waste: CA selects the node pool with the least available resources after pod scheduling.

Scale-in condition

CA checks resource usage of nodes at the specified interval, which is 10 seconds by default. If the resource utilization of a node is lower than 50% (default value) for 10 minutes, and the pods on this node can be moved to other nodes, CA automatically deletes the node from the cluster. In this case, the pods on the node are automatically scheduled to other nodes.

A node will not be scaled in if the pods on this node meet one of the following conditions:

  • The pods are configured with PodDisruptionBudget (PDB), but do not meet the PDB.
  • The pods belong to the kube-system namespace and are not managed by DaemonSets.
  • The pods are not created by controllers such as Deployment, ReplicaSet, job, and StatefulSet.
  • The pods use local storage.
  • The pods cannot be scheduled to other nodes due to reasons such as affinity and anti-affinity rules.

Usage notes

  • CA conflicts with the Auto Scaling service that is based on monitoring metrics. Do not configure automatic scaling based on monitoring metrics for the node pools in a cluster.
  • You must specify the request value of pods. CA is triggered when the pods cannot be scheduled due to insufficient resources based on the request value.
  • Do not directly modify the nodes that belong to a node pool. Make sure that the nodes in a node pool have the same configurations.
  • Services may be interrupted during a scale-in. For example, if a Service contains a controller with a single replica, the pod may be restarted on another node when the current node of the pod for that replica is deleted. Before you enable automatic scaling, make sure your Services can tolerate potential interruption. We recommend that you configure PDB for pods to prevent a node from being deleted during a scale-in.
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback