Skip to content

Cluster Autoscaler

Cluster Autoscaler (CA) is a cluster-level component for Kubernetes designed to automatically adjust the size of a node pool.^[400-devops-06-kubernetes-k8s-ithelp-day25-readme.md]

Functionality

The primary function of the Cluster Autoscaler is to manage the number of nodes in a cluster based on resource utilization and scheduling demands.^[400-devops-06-kubernetes-k8s-ithelp-day25-readme.md]

It performs Scale-up when there are pending pods that cannot be scheduled due to insufficient resources. If a Pod remains in an unschedulable state for approximately ten seconds, the autoscaler evaluates whether to provision new nodes.[^[400-devops-06-kubernetes-k8s-ithelp-day25-readme.md:23-24]] While the decision to scale up occurs rapidly, the actual time for a new node to become ready can range from a few minutes to over ten minutes.[^[400-devops-06-kubernetes-k8s-ithelp-day25-readme.md:23-24]]

It performs Scale-down when resource utilization drops. By default, it checks every ten seconds to see if the total CPU and memory requests are below 50% and if there are no restrictions preventing node removal.[^[400-devops-06-kubernetes-k8s-ithelp-day25-readme.md:26-27]]

Configuration and Constraints

The ability of the Cluster Autoscaler to scale is dependent on specific configurations and constraints:

  • Pod Constraints: The autoscaler cannot scale down if evicting pods would violate Pod affinity/anti-affinity rules or [[PodDisruptionBudget]] limits.[^[400-devops-06-kubernetes-k8s-ithelp-day25-readme.md:30-31]]
  • Annotations: Specific annotations can be added to nodes to prevent them from being scaled down. For example, setting "cluster-autoscaler.kubernetes.io/scale-down-disabled": "true" on a node will protect it from termination.[^[400-devops-06-kubernetes-k8s-ithelp-day25-readme.md:32-33]]

Environment Requirements

Cluster Autoscaler is typically used in platform-level environments such as Google GKE or AWS EKS, as it requires a node pool to manage.[^[400-devops-06-kubernetes-k8s-ithelp-day25-readme.md:36-37]] It is not applicable in single-node local environments like docker-desktop.[^[400-devops-06-kubernetes-k8s-ithelp-day25-readme.md:36-37]]

Sources

  • 400-devops-06-kubernetes-k8s-ithelp-day25-readme.md