MCS’s Autoscaler for Kubernetes

MCS’s Autoscaler for Kubernetes dynamically scales your Kubernetes cluster up and down, ensuring that there are always sufficient resources to run all Pods and at the same time maximizing resource efficiency in the cluster. It does this by optimizing Pod placement across the cluster in a process we call Tetris Scaling, and by managing Headroom, a buffer of spare node capacity enabling rapid Pod scaling.

How the Autoscaler Works

Spotinst provides an in-cluster solution for integrating the K8s cluster called
Pod mode, in which Elastigroup works with a designated Pod running the Spotinst Controller inside your Kubernetes cluster. The Spotinst Controller reports constant updates about the clusters’ condition via a one-way link. Using that information, Elastigroup scales the cluster up or down according to the overall nodes utilization and your Pods’ needs.
The scaling processes are Pod driven – machine size is determined by the Pod & Deployment parameters and automatically launched by Elastigroup.

Tetris Scaling

MCS’s Autoscaler optimizes infrastructure allocation in a process we call Tetris Scaling. Tetris Scaling optimizes the Pod placement across the infrastructure of a cluster. When a Pod is launched in K8S, the K8S Scheduler tries to find free capacity for the Pod to run. In some cases, there aren’t enough resources to meet the Pod’s demands. MCS’s Autoscaler automatically detects these events and launch additional nodes as required.

For example, in the event of a failed scheduling of Pods, K8S writes the following error message, which the MCS Autoscaler uses to trigger a scale up:

0/13 nodes are available: 13 MatchNodeSelector, 3 PodToleratesNodeTaints, 4 MatchInterPodAffinity, 4 PodAntiAffinityRulesNotMatch.



The Autoscaler provides the option to include a buffer of spare capacity known as headroom. Headroom ensures that the cluster has the capacity to quickly scale more Pods without waiting for new nodes to be provisioned, and also to prevent instances from being over-utilized. MCS’s Automatic Autoscaler optimally manages the headroom to provide the best possible cost/performance balance. However, headroom may also be manually configured to support any use case.
The number of headroom units to reserve for the actual headroom in the cluster is defined as numOfUnits. The numOfUnits consists of CPU units (cpuPerUnit) defined as 1000 units per 1 vCPU, and Memory (memoryPerUnit) in MiB.

In the example below 3 Headroom units have been configured, where each unit is defined as 256 CPU and 512 MiB.

Note: Scaling to ensure adequate headroom takes precedence over other scaling operations.
What’s Next
  • MCS’s Autoscaler for Kubernetes uses the Spotinst Controller to monitor the cluster. Learn how to install the Spotinst Controller here.