// Module included in the following assemblies:
//
// * hosted_control_planes/hcp-deploy/hcp-deploy-ibm-power.adoc

:_mod-docs-content-type: PROCEDURE
[id="hcp-scale-the-nodepool_{context}"]
= Scaling the node pool

[role="_abstract"]
After you approve your agents, you can scale the node pools. The `agentLabelSelector` value that you configured in the node pool ensures that only matching agents get added to the cluster. This also helps scale down the node pool.

To remove specific architecture nodes from the cluster, scale down the corresponding node pool.

.Procedure

* Scale the node pool by running the following command:
+
[source,terminal]
----
$ oc -n <clusters_namespace> scale nodepool <nodepool_name> --replicas 2
----
+
[NOTE]
====
The Cluster API agent provider picks two agents randomly to assign to the hosted cluster. These agents pass through different states and then join the hosted cluster as {product-title} nodes. The various agent states are `binding`, `discovering`, `insufficient`, `installing`, `installing-in-progress`, and `added-to-existing-cluster`.
====

.Verification

. List the agents by running the following command:
+
[source,terminal]
----
$ oc -n <hosted_control_plane_namespace> get agent
----
+
.Example output
----
NAME                                   CLUSTER         APPROVED   ROLE          STAGE
4dac1ab2-7dd5-4894-a220-6a3473b67ee6   hypercluster1   true       auto-assign  
d9198891-39f4-4930-a679-65fb142b108b                   true       auto-assign  
da503cf1-a347-44f2-875c-4960ddb04091   hypercluster1   true       auto-assign
----

. Check the status of a specific scaled agent by running the following command:
+
[source,terminal]
----
$ oc -n <hosted_control_plane_namespace> get agent -o jsonpath='{range .items[*]}BMH: {@.metadata.labels.agent-install\.openshift\.io/bmh} Agent: {@.metadata.name} State: {@.status.debugInfo.state}{"\n"}{end}'
----
+
.Example output
----
BMH: ocp-worker-2 Agent: 4dac1ab2-7dd5-4894-a220-6a3473b67ee6 State: binding
BMH: ocp-worker-0 Agent: d9198891-39f4-4930-a679-65fb142b108b State: known-unbound
BMH: ocp-worker-1 Agent: da503cf1-a347-44f2-875c-4960ddb04091 State: insufficient
----

. After the agents reach the `added-to-existing-cluster` state, verify that the {product-title} nodes are ready by running the following command:
+
[source,terminal]
----
$ oc --kubeconfig <hosted_cluster_name>.kubeconfig get nodes
----
+
.Example output
----
NAME           STATUS   ROLES    AGE     VERSION
ocp-worker-1   Ready    worker   5m41s   v1.24.0+3882f8f
ocp-worker-2   Ready    worker   6m3s    v1.24.0+3882f8f
----

. Adding workloads to the nodes can reconcile some cluster operators. The following command displays the creation of two machines that happened after scaling up the node pool:
+
[source,terminal]
----
$ oc -n <hosted_control_plane_namespace> get machines
----
+
.Example output
----
NAME                            CLUSTER               NODENAME       PROVIDERID                                     PHASE     AGE   VERSION
hypercluster1-c96b6f675-m5vch   hypercluster1-b2qhl   ocp-worker-1   agent://da503cf1-a347-44f2-875c-4960ddb04091   Running   15m   4.11.5
hypercluster1-c96b6f675-tl42p   hypercluster1-b2qhl   ocp-worker-2   agent://4dac1ab2-7dd5-4894-a220-6a3473b67ee6   Running   15m   4.11.5
----
