fbpx

Launch specifications allow you to configure multiple workload types on the same ocean cluster.
With Ocean launch specs you can configure sets of labels and taints to go along with a custom AMI and user data script that will be used for the nodes that will serve your labeled pods.
If a pod have no node-selector labels configured, the default AMI and user data configured on the Ocean cluster will be used.

Configuration:
  1. Log in to Spotinst Console
  2. Navigate to your Ocean Cluster
  3. Click on the Actions menu and select Launch Specifications
  4. Click Add Specification
    1. Add the labels which identify your Nodes
    2. Set the User Data script and make sure to label you Nodes according to your labels selection
    3. Optional: Set a custom AMI for the launch specification

 

Example

Use case: Running a Windows-based node in a Linux-based cluster
In the given scenario, the default Ocean AMI will include a Linux OS, for a specific Pod – ‘WinPod’ a Windows image is required.
To ensure that the pod WinPod is using a Windows image you will need to perform the following steps:

  1. Configure your WinPod Pod with a dedicated nodeSelector
    1. i.e:
      apiVersion: v1
      kind: Pod
      metadata:
      name: WinPod
      spec:
        containers:
        - name: WinPodCon
          image: WinPodCon
          imagePullPolicy: IfNotPresent
        nodeSelector:
          runOnWin: true
  2. Configure your Ocean cluster with a launch specification that serves the WinPod nodeSelector label
    1. Log in to Spotinst Console
    2. Navigate to your Ocean Cluster
    3. Click on the Actions menu and select Launch Specifications
    4. Click Add Specification
      1. Add the the following label:
        1. Key: runOnWin
        2. Value: true
      2. Set the User Data script and make sure to label you Nodes with the “runOnWin”: “true” label
      3. Set the custom launch specification AMI to Windows OS

Custom Labels

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. See the Kubernetes documentation here for more.

Ocean supports custom label selectors, as well as built-in node labels and affinity/anti-affinity for pods & nodes.

Once configured, Ocean considers the constraints and launches capacity only when Pods that have the predefined labels are waiting to be scheduled.

 

Configuring Custom Label Selectors

Step 1: Label the pods

Make sure that your Pods are labeled properly. See the Kubernetes documentation.

Step 2: Define the custom labels in Ocean

In your Ocean cluster go to Actions -> Custom Launch Specifications:

Here you can add key / value of custom label and click on “Add Label”.

Step 3: Add labels to the nodes

 

Add Labels to EKS:

Add labels to the nodes by using the user data:

--kubelet-extra-args --node-labels=mykey=myvalue,mykey2=myvalue2

e.g.:

#!/bin/bash
set -o xtrace
/etc/eks/bootstrap.sh Ocean_Cluster --kubelet-extra-args --node-labels=mykey=myvalue,mykey2=myvalue2

For all of the above, new nodes will be launched with new labels.

 

Add labels to Spotinst-KOPS (Cluster that were created by KOPS natively):

  1. Recognize the IG name you originally created (“nodes” in the following example)
  2. Run kops edit ig nodes and add the relevant label
  3. Perform kops update cluster

 

 If a pod requires a GPU instance, please add the relevant GPU AMI in the custom launch spec section. Ocean will spin up instances accordingly.
Specific labels are not required in this case.

Example:

resources:
        limits:
          nvidia.com/gpu: 1

You don’t need to add any extra label for GPU support, you can just use taints such that only your GPU based pods select a specific launch specification which contains the required GPU AMI.