Labels are key/value pairs that are attached to objects, such as pods. Labels allow constraining a pod to only be able to run on particular nodes or have a preference for a particular node.

Spotinst supports Custom Labels and node selectors when scaling capacity up or down.

As a prerequisite – the Pods should already have the Labels set

To begin, follow the steps below:

1. Add labels to your nodes

Add the following attribute to the ig_spec.yaml in your user-data start-up script.

Add following attribute to your ig_spec.yaml in your user-data start-up script.

    group: microservices
    kops.k8s.io/instancegroup: microservices
2. Define the custom labels in Elastigroup

Add the property labels with key/value under group.thirdPartiesIntegration.kubernetes

  "group": {
    "name": "microservices.kubernetes.mycompany.local",
    "thirdPartiesIntegration": {
      "kubernetes": {
        "integrationMode": "pod",        
        "clusterIdentifier": "microservices-kubernetes-mycompany-local",
        "autoScale": {
          "isEnabled": true,
          "cooldown": 300,
          "down": {
            "evaluationPeriods": 5
          "headroom": {
            "cpuPerUnit": 0,
            "memoryPerUnit": 0,
            "numOfUnits": 0
          "labels": [
              "key": "group",
              "value": "microservices"
              "key": "kops.k8s.io/instancegroup",
              "value": "microservices"
          "isAutoConfig": false

Once configured both on the Nodes and Elastigroup, the Spotinst Kubernetes Controller will consider those constraints and will only launch capacity into Elastigroup when Pods that are waiting to be scheduled have the matching labels defined on Elastigroup

Built-in Labels Support

Spotinst also supports Built-in Labels in scale down. The controller looks for other eligible instances in the cluster to accommodate the containers that run on the host that is scheduled for scale down.