Cloud Experts Documentation

Scalability and Cost Management for Azure Red Hat OpenShift

This content is authored by Red Hat experts, but has not yet been tested on every supported configuration.

With Azure Red Hat OpenShift (ARO), you can take advantage of flexible pricing models, including pay-as-you-go and reserved instances, to further optimize your cloud spending. Its auto-scaling capabilities help reduce costs by avoiding over-provisioning, making it a cost-effective solution for organizations seeking to balance performance and expenditure

This guide demonstrates how to implement scheduled scaling in Azure Red Hat OpenShift (ARO), enabling your cluster to automatically adjust its size according to a predefined schedule. By configuring scale-downs during periods of low activity and scale-ups when additional resources are needed, you can ensure both cost efficiency and optimal performance.

Leveraging ARO’s automated scaling capabilities allows for dynamic adjustment of worker node capacity, eliminating wasteful spending on idle infrastructure resources. This approach reduces the need for manual intervention and ensures consistent compute resources for both traditional workloads and AI/ML operations during peak hours.

Prerequisites

The following three CLIs need to be installed.

Note: You must log into your ARO cluster via your oc cli before going through the following steps.

Step 1: Create a New project and Service Account

Create a new project

Create the service account

Step 2: Create RBAC Resources

Create the necessary ClusterRole and ClusterRoleBinding to grant permissions:

Step 3: Create the Scaling Script

Environment Variables

  • DESIRED_REPLICAS: Number of replicas per machineset (default: 3)
  • MACHINESET_LABEL: Label selector for machinesets (default: worker role)

Create a ConfigMap containing the scaling script:

Step 4: Create the CronJob

For testing you can adjust accordingly. For example

  • "0 8 * * *" - Daily at 8:00 AM
  • "0 8 * * 1-5" - Weekdays at 8:00 AM
  • "0 8,20 * * *" - Daily at 8:00 AM and 8:00 PM
  • "*/30 * * * *" - Every 30 minutes

Create a CronJob that will execute the scaling script:

Step 5: Verify the Setup

Check that all resources are created correctly:

Verify service account

Example output:

Verify RBAC

Example output:

Verify ConfigMap

Example output:

Verify CronJob

Example output:

Step 6: Test the CronJob

You can manually trigger the CronJob to test it:

Create a manual job from the CronJob

Check the job status

Check the pod logs

Example output:

Step 7: Monitor and Manage

Monitor the CronJob execution:

Check CronJob status

Example output:

View recent jobs

Example output:

Creating a Scale-Down CronJob

To create a complementary scale-down job:

Finally sit back and watch the machinesets scale on the schedule you configured.

Check machinesets

Check machines

Check nodes

Interested in contributing to these docs?

Collaboration drives progress. Help improve our documentation The Red Hat Way.

Red Hat logo LinkedIn YouTube Facebook Twitter

Products

Tools

Try, buy & sell

Communicate

About Red Hat

We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Subscribe to our newsletter, Red Hat Shares

Sign up now
© 2023 Red Hat, Inc.