// Module included in the following assemblies:
//
// * cloud_experts_tutorials/cloud-experts-getting-started/cloud-experts-getting-started-managing-worker-nodes.adoc

:_mod-docs-content-type: PROCEDURE
[id="cloud-experts-getting-started-managing-worker-nodes-create-machine-pools_{context}"]
= Creating a machine pool

[role="_abstract"]
You can create a machine pool with either the command-line interface (CLI) or the user interface (UI).

.Procedure
* Create a machine pool by using the {rosa-cli-first}.
.. Run the following command:
+
[source,terminal]
----
rosa create machinepool --cluster=<cluster-name> --name=<machinepool-name> --replicas=<number-nodes>
----
+
**Example input**
+
[source,terminal]
----
 $ rosa create machinepool --cluster=my-rosa-cluster --name=new-mp
 --replicas=2
----
+
**Example output**
+
[source,terminal]
----
I: Machine pool 'new-mp' created successfully on cluster 'my-rosa-cluster'
I: To view all machine pools, run 'rosa list machinepools -c my-rosa-cluster'
----

.. *Optional:* Add node labels or taints to specific nodes in a new machine pool by running the following command:
+
[source,terminal]
---- 
rosa create machinepool --cluster=<cluster-name> --name=<machinepool-name> --replicas=<number-nodes> --labels=`<key=pair>`
----
+
**Example input**
+
[source,terminal]
----
$ rosa create machinepool --cluster=my-rosa-cluster --name=db-nodes-mp --replicas=2 --labels='app=db','tier=backend'
----
+
**Example output**
+
[source,terminal]
----
I: Machine pool 'db-nodes-mp' created successfully on cluster 'my-rosa-cluster'
----
+
This creates an additional 2 nodes that can be managed as a unit and also assigns them the labels shown.  

.. Run the following command to confirm machine pool creation and the assigned labels:
+
[source,terminal]
----
rosa list machinepools --cluster=<cluster-name>
----
+
**Example output**
+
[source,terminal]
----
ID          AUTOSCALING  REPLICAS  INSTANCE TYPE  LABELS            TAINTS    AVAILABILITY ZONES
Default     No           2         m5.xlarge                                  us-east-1a
----

* Create a machine pool with the UI.
.. Log in to the {cluster-manager-url} and click your cluster.
+
image::cloud-experts-getting-started-managing-ocm-cluster.png[]

.. Click *Machine pools*.
+
image:cloud-experts-getting-started-managing-mp-ocm.png[]

.. Click *Add machine pool*.
.. Enter the desired configuration.
+
[TIP]
====
You can also and expand the *Edit node labels and taints* section to add node labels and taints to the nodes in the machine pool.
====
+
image::cloud-experts-getting-started-managing-mp-nlt.png[]

.. You will see the new machine pool you created.
+
image::cloud-experts-getting-started-managing-mp-fromui.png[]