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. This guide has been validated on OpenShift 4.20. Operator CRD names, API versions, and console paths may differ on other versions.
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
Note: You must log into your ARO cluster via your oc CLI before going through the following steps.
Create a New project and Service Account
-
Create a new project
-
Create the service account
Create RBAC Resources
-
Create the ClusterRole to grant permissions
-
Create the ClusterRoleBinding
Create the Scaling Script
-
Set 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:
Create the CronJob
Adjust the cron expression as needed.
"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 Scale-Up CronJob:
-
Create a Scale-Down CronJob:
Verify the Setup
-
Verify service account
Example output:
-
Verify RBAC
Example output:
-
Verify ConfigMap
Example output:
-
Verify CronJob
Example output:
Test the CronJob
-
Manually trigger a Job from the CronJob to test it without waiting for the scheduled time.
-
Check the job status
Example output:
-
Check the pod logs
Confirm scaling results
Once the job is done, monitor the machineset, machines, and node statuses to ensure the cluster is scaling as expected.
-
Check machinesets
-
Check machines
-
Check nodes