// Module included in the following assemblies:
//
// * hosted_control_planes/hcp-machine-config.adoc

:_mod-docs-content-type: PROCEDURE
[id="scale-up-autoscaler-hcp_{context}"]
= Scaling up workloads in a hosted cluster

[role="_abstract"]
To scale up the workloads in your hosted cluster, you can use the `ScaleUpOnly` behavior.

.Prerequisites

* You have created the `HostedCluster` and `NodePool` resources.

.Procedure

. Enable cluster autoscaling for your hosted cluster by setting the scaling behavior to `ScaleUpOnly`. Run the following command:
+
[source,terminal]
----
$ oc patch -n <hosted_cluster_namespace> hostedcluster <hosted_cluster_name> --type=merge --patch='{"spec": {"autoscaling": {"scaling": "ScaleUpOnly", "maxPodGracePeriod": 60}}}'
----

. Remove the `spec.replicas` field from the `NodePool` resource to allow the cluster autoscaler to manage the node count. Additionally, enable cluster autoscaling to configure the minimum and maximum node counts for your node pools. Enter the following command:
+
[source,terminal]
----
$ oc -n clusters patch nodepool yhe-hosted-ap-northeast-1a \
  --type=json \
  -p='[
    {"op":"remove","path":"/spec/replicas"},
    {"op":"add","path":"/spec/autoScaling","value":{"min":2,"max":4}}
  ]'
----

.Verification

. Verify that all compute nodes are in the `Ready` status by running the following command:
+
[source,terminal]
----
$ oc --kubeconfig <hosted_cluster_name>.kubeconfig get nodes
----

. Verify that the compute nodes are scaled up successfully by checking the node count for your node pools. Run the following command:
+
[source,terminal]
----
$ oc --kubeconfig nested.config get nodes -l 'hypershift.openshift.io/nodePool=<node_pool_name>'
----
