
Labels are key/value
pairs that are attached to objects, such as pods
. With Labels, you can constrain a pod to only be able to run on particular nodes or to prefer to run on particular nodes.
We are happy to introduce support for Custom Labels and Node selectors when scaling capacity up or down.
Step 1; Add Labels to your Nodes
Add the following attribute to your ig_spec.yaml
in your user-data start-up script.
nodeLabels: group: microservices kops.k8s.io/instancegroup: microservices
Step 2; Define your 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 on both sides (Nodes / Elastigroup), the Spotinst Kubernetes Controller, will consider these 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
In addition, Built-in Labels are supported in scale down, the controller will look 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
This feature is now Generally Available in Elastigroup. Read more about it in our API Documentation.