1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 15:46:57 +01:00
Files
openshift-docs/modules/rosa-adding-node-labels.adoc
2021-11-23 09:37:03 +00:00

56 lines
2.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * nodes/nodes/rosa-managing-worker-nodes.adoc
[id="rosa-adding-node-labels_{context}"]
= Adding node labels
Add or edit labels for worker nodes at any time to manage the nodes in a manner that is relevant to you. For example, you can assign types of workloads to specific nodes.
Labels are assigned as key=value pairs. Each key must be unique to the object it is assigned to. Labels do not change or impact the core system values, such as a machine pool ID.
[NOTE]
====
Currently, adding node labels on an existing machine pool adds the labels to only new nodes that are created in that pool. The existing nodes will not have the node label applied. If you need nodes with the node label, you can either scale down the nodes in the machine pool to zero (this will not work with the 'default' machine pool), add the node label, and then scale back up to the desired amount. You can also create a new machine pool and define the node labels at creation time.
====
.Procedure
. To create a new machine pool, add the node labels, and create replica worker nodes, enter the following command:
+
[source,terminal]
----
$ rosa create machinepool --cluster=<cluster-name> --name=<machinepool_ID> --replicas=<number-nodes> --labels=<key=pair>
----
+
This example shows how to use labels to assign a database workload to a group of worker nodes, and creates 2 replica worker nodes that you can manage as one unit:
+
[source,terminal]
----
$ rosa create machinepool --cluster=mycluster --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 'mycluster'
----
.Verification
. To verify that the machine pool, labels, and replicas were created, enter the following command:
+
[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
db-nodes-mp No 2 m5.xlarge app=db, tier=backend us-east-1a
----