0% found this document useful (0 votes)
326 views

DO280 Automatically Scaling

The document describes how to configure automatic scaling on an OpenShift cluster. It provides commands to create ClusterAutoscaler and MachineAutoscaler custom resources to enable horizontal pod autoscaling and adding/removing worker nodes when resource usage thresholds are met. It then demonstrates the autoscaling by deploying a load testing application, scaling the deployment, and observing the pods and nodes scale up and down automatically based on resource usage.

Uploaded by

Srinivasan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
326 views

DO280 Automatically Scaling

The document describes how to configure automatic scaling on an OpenShift cluster. It provides commands to create ClusterAutoscaler and MachineAutoscaler custom resources to enable horizontal pod autoscaling and adding/removing worker nodes when resource usage thresholds are met. It then demonstrates the autoscaling by deploying a load testing application, scaling the deployment, and observing the pods and nodes scale up and down automatically based on resource usage.

Uploaded by

Srinivasan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

lab scale-automatic start

source /usr/local/etc/ocp4.config

oc login -u admin -p ${RHT_OCP4_USER_PASSWD} ${RHT_OCP4_MASTER_API}

vim ~/DO280/labs/scale-automatic/clusterautoscaler.yaml

resourceLimits:
maxNodesTotal: 6
scaleDown:
enabled: true

oc create --save-config -f ~/DO280/labs/scale-automatic/clusterautoscaler.yaml

oc get machinesets -n openshift-machine-api

vim ~/DO280/labs/scale-automatic/machineautoscaler.yaml

spec:
minReplicas: 1
maxReplicas: 3
scaleTargetRef:
apiVersion: machine.openshift.io/v1beta1
kind: MachineSet
name: MACHINE-SET-NAME

oc create --save-config -f ~/DO280/labs/scale-automatic/machineautoscaler.yaml -n


openshift-machine-api

oc login -u developer -p ${RHT_OCP4_USER_PASSWD}

oc new-project scale-automatic

oc create --save-config -f ~/DO280/labs/scale-automatic/loadtest.yaml

oc login -u admin -p ${RHT_OCP4_USER_PASSWD}

oc scale --replicas 3 deployment/loadtest -n scale-automatic

watch oc get pods -o wide -n scale-automatic

watch oc get nodes -l node-role.kubernetes.io/worker

oc delete project scale-automatic

oc delete clusterautoscaler default

oc delete machineautoscaler scale-automatic -n openshift-machine-api

oc get machinesets -n openshift-machine-api

oc scale machineset ocp-qz7hf-worker-us-west-1b --replicas 2 -n openshift-machine-


api

lab scale-automatic finish

You might also like