How to use Spot instance on ROSA/OSD

Solution Verified - Updated -

Environment

  • Red Hat OpenShift Service on AWS (ROSA)
    • 4
  • Red Hat OpenShift Dedicated (OSD)
    • 4
    • Customer Cloud Subscription (CCS)
  • rosa CLI version 1.1.5+

Issue

  • Is it possible to use Spot instances for worker nodes in ROSA or OSD?

Resolution

Disclaimer: Links contained herein to external website(s) are provided for convenience only. Red Hat has not reviewed the links and is not responsible for the content or its availability. The inclusion of any link to an external website does not imply endorsement by Red Hat of the website or their entities, products or services. You agree that Red Hat is not responsible or liable for any loss or expenses that may result due to your use of (or reliance on) the external site or content.

Currently, only additional Machine Pools can be configured with Spot instances on ROSA or OSD. The "Default" Machine Pool cannot be used with Spot instances.

Important Note: As explained in the AWS documentation: "Spot Instances are a cost-effective choice if you can be flexible about when your applications run and if your applications can be interrupted. For example, Spot Instances are well-suited for data analysis, batch jobs, background processing, and optional tasks". Due to that, Spot instances should not be used for critical workloads. Refer to the AWS documentation about Spot Instances for additional information.

It's possible to configure it using either the rosa CLI or the OCM console for ROSA. In OSD it's needed to use the OCM console.

Configuring Machine Pool with Spot instances via rosa CLI:

This option is not available in older rosa CLI versions. Download current version of rosa CLI for running this from the rosa mirror.

$ rosa create machinepool --help | grep spot
  # Add a machine pool with spot instances to a cluster
  rosa create machinepool -c mycluster --name=mp-1 --replicas=2 --instance-type=r5.2xlarge --use-spot-instances \
    --spot-max-price=0.5
      :
      --spot-max-price string   Max price for spot instance. If empty use the on-demand price. (default "on-demand")
      --use-spot-instances      Use spot instances for the machine pool.

Configuring Machine Pool with Spot instances via OCM UI

  1. Select the name of the cluster in the OCM console.
  2. Select the "Machine pools" tab and click the "Add machine pool" button.
  3. Add the Machine Pool with the Spot instance there by checking the "Use Amazon EC2 Spot Instances" check box:

spot_instance

Refer to the documentation for additional information:

Root Cause

AWS Spot instances can be used for new Machine Pools in OSD (with CCS) and ROSA, but not for the "Default" Machine Pool.

Diagnostic Steps

If the rosa CLI version is old, then the Spot instance option would not be shown. Check the version of the rosa CLI executing the following command:

$ rosa version

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments