fbpx

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.

The 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.

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

nodeLabels:
    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": {
        "clusterIdentifier": "microservices-kubernetes-mycompany-local",
          "labels": [
            {
              "key": "group",
              "value": "microservices"
            },
            {
              "key": "kops.k8s.io/instancegroup",
              "value": "microservices"
            }
          ]
        }
      }
    }
  }
}

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.

kubernetes.io/hostname
failure-domain.beta.kubernetes.io/zone
failure-domain.beta.kubernetes.io/region
beta.kubernetes.io/instance-type
beta.kubernetes.io/os
beta.kubernetes.io/arch