Configure autoscaling

Steps to configure autoscaling for worker nodes on cloudscale with the cloudscale Machine API Provider.

Starting situation

  • You already have an OpenShift 4 cluster on cloudscale

  • You have admin-level access to the cluster

  • You’ve already deployed the cloudscale Machine API provider and adopted the worker nodes.

Prerequisites

The following CLI utilities need to be available locally:

Prepare local environment

  1. Select the cluster for which you want to enable autoscaling

    CLUSTER_ID=c-cluster-id-1234 (1)
    1 Replace with the Project Syn ID of the cluster
  2. Create local directory to work in

    We strongly recommend creating an empty directory, unless you already have a work directory for the cluster you’re about to work on. This guide will run Commodore in the directory created in this step.

    export WORK_DIR=/path/to/work/dir
    mkdir -p "${WORK_DIR}"
    pushd "${WORK_DIR}"
  3. Compile the cluster catalog

    commodore catalog compile "$CLUSTER_ID"

Enable autoscaling

  1. Switch to tenant repo checkout

    TENANT_ID=$(yq .parameters.cluster.tenant inventory/classes/params/cluster.yml)
    pushd "inventory/classes/${TENANT_ID}"
  2. Enable autoscaling with a range from 3 to 6 nodes for the app machineset

    yq -i '.parameters.openshift4_nodes.autoscaling.enabled = true' \
      ${CLUSTER_ID}.yml
    yq -i '.parameters.openshift4_nodes.autoscaling.machineAutoscalers.app.minReplicas=3' \
      ${CLUSTER_ID}.yml
    yq -i '.parameters.openshift4_nodes.autoscaling.machineAutoscalers.app.maxReplicas=6' \
      ${CLUSTER_ID}.yml
    If you have different machinesets, or want to scale in a different range, adjust the commands accordingly.
    See the component openshift4-nodes parameters documentation for details on how to customize the autoscaling behavior.
  3. Commit and push the changes

    git commit -m "Enable autoscaling for ${CLUSTER_ID}" "${CLUSTER_ID}.yml"
    git push
    popd

Upstream documentation