fbpx

Spotinst in-cluster Autoscaler

Elastigroup will work with a designated pod inside your Kubernetes cluster that will report constant updates about the clusters’ condition via a one-way link.

Using that information, the Elastigroup will scale the cluster up or down according to the overall nodes utilization and your pods’ needs.

In order to create this connection between your k8s cluster and Elastigroup, you will need to implement a small configuration change on both the k8s cluster side and the Elastigroup side as instructed below;

 


Elastigroup Configuration

Please create an Elastigroup and configure the incluster k8s integration using a pod mode with a cluster-identifier (important!),  then configure the autoscaling parameters for the k8s.

API example

"kubernetes": {
     "integrationMode": "pod",
     "clusterIdentifier": "cluster-test"
   }

 

Terraform Example

resource "spotinst_aws_group" "example" {
  ...

  kubernetes_integration {
    integration_mode   = "pod"
    cluster_identifier = "k8s-cluster-name"

    autoscale_is_enabled = true
    autoscale_cooldown   = 300
    autoscale_headroom {
      cpu_per_unit    = 2048
      memory_per_unit = 1024
      num_of_units    = 10
    }
    autoscale_down {
      evaluation_periods = 5
    }
  }
  
  ...
}


 

What is Headroom?

A buffer of spare capacity (in terms of both memory and CPU) to make sure that when we want to scale more tasks, we don’t have to wait for new instances, and also to prevent instances from being over-utilized.

Each headroom unit consists of 2 definitions: one for CPU units “cpuPerUnit” (see below) and one for Memory “memoryPerUnit” (in MiB). Also, numOfUnits the number of units to reserve for the actual headroom in the cluster.

CPU Units vary across container orchestrators:
ECS: 1024 units = 1 vCPU
Kubernetes: 1000 units = 1 vCPU
Nomad: 1 unit = 1 MHz of CPU

NOTE: Headroom takes precedence over scaling operations.

 


 

Kuberenetes Configuration

See the full documentation on how to install the Spotinst’s Kubernetes Controller