Scale up and down workloads in a hosted cluster
To scale up and down the workloads in your hosted cluster, you can use the ScaleUpAndScaleDown behavior. The compute nodes scale up when you add workloads and scale down when you delete workloads.
-
You have created the
HostedClusterandNodePoolresources.
-
Enable cluster autoscaling for your hosted cluster by setting the scaling behavior to
ScaleUpAndScaleDown. Run the following command:$ oc patch -n <hosted_cluster_namespace> \ hostedcluster <hosted_cluster_name> \ --type=merge \ --patch='{"spec": {"autoscaling": {"scaling": "ScaleUpAndScaleDown", "maxPodGracePeriod": 60, "scaleDown": {"utilizationThresholdPercent": 50}}}}' -
Remove the
spec.replicasfield from theNodePoolresource to allow cluster autoscaler to manage the node count. Run the following command:$ oc patch -n <hosted_cluster_namespace> \ nodepool <node_pool_name> \ --type=json \ --patch='[{"op": "remove", "path": "/spec/replicas"}]' -
Enable cluster autoscaling to configure the minimum and maximum node counts for your node pools. Run the following command:
$ oc patch -n <hosted_cluster_namespace> \ nodepool <nodepool_name> \ --type=merge --patch='{"spec": {"autoScaling": {"max": 3, "min": 1}}}'
-
To verify that all compute nodes are in the
Readystatus, run the following command:$ oc --kubeconfig <hosted_cluster_name>.kubeconfig get nodes