fbpx

Constraints and Labels

To make scheduling more efficient and compatible with Kubernetes, the Elastigroup supports all of the Kubernetes constraint mechanisms for scheduling pods:

  • Node Selector – Constrain Pods to nodes with particular labels.
  • Node Affinity – Constrain which nodes your Pod is eligible to be scheduled on based on labels on the node.
    We support hard / soft affinity (requiredDuringSchedulingIgnoredDuringExecution /preferredDuringSchedulingIgnoredDuringExecution)
  • Pod Affinity and Pod Anti-Affinity – Schedules a Pod based on which other Pods are or are not running on a node.
  • Pod Port Restrictions – We validate that each pod will have required ports available on the machine

Spotinst Labels

Spotinst labels allow you to adjust the default behavior of scaling in Ocean, by adding Spotinst labels to your pods you can control the node termination process or its life cycle.

Available labels:
Label KeyAccepted ValuesDescription
spotinst.io/restrict-scale-downtrueWhen a node is running a pod with such a label, it will not be scaled down by Spotinst’s Auto-Scaler
spotinst.io/node-lifecycleodPods which contain this label are forced to run on an on-demand instance
spotinst.io/gpu-typenvidia-tesla-v100
nvidia-tesla-p100
nvidia-tesla-k80
nvidia-tesla-p4
nvidia-tesla-t4
Sets the GPU accelerator

Note: This setting applies only to GKE clusters

 

Examples

using nodeSelector:

apiVersion: v1
kind: Pod
metadata:
  name: with-node-selector
  labels:
    spotinst.io/restrict-scale-down: true
spec:
  containers:
  - name: with-node-selector
    image: k8s.gcr.io/pause:2.0
    imagePullPolicy: IfNotPresent
  nodeSelector:
    spotinst.io/node-lifecycle: od

using nodeAffinity:

apiVersion: v1
kind: Pod
metadata:
  name: with-node-affinity
spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: spotinst.io/node-lifecycle
            operator: In
            values:
            - od
  containers:
  - name: with-node-affinity
    image: k8s.gcr.io/pause:2.0