1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/rosa-adding-taints-cli.adoc
2025-09-04 17:57:02 +00:00

135 lines
5.1 KiB
Plaintext

// Module included in the following assemblies:
//
// * rosa_cluster_admin/rosa_nodes/rosa-managing-worker-nodes.adoc
// * nodes/rosa-managing-worker-nodes.adoc
// * osd_cluster_admin/osd_nodes/osd-managing-worker-nodes.adoc
:_mod-docs-content-type: PROCEDURE
[id="rosa-adding-taints-cli_{context}"]
= Adding taints to a machine pool using the ROSA CLI
You can add taints to a machine pool for your {product-title} cluster by using the {rosa-cli-first}.
[NOTE]
====
For users of `rosa` version 1.2.25 and prior versions, the number of taints cannot be changed within the machine pool (ID=`Default`) created along with the cluster. For users of `rosa` version 1.2.26 and beyond, the number of taints can be changed within the machine pool (ID=`worker`) created along with the cluster.
ifndef::openshift-rosa-hcp[]
There must be at least one machine pool without any taints and with at least two replicas for a Single-AZ cluster or three replicas for a Multi-AZ cluster.
endif::openshift-rosa-hcp[]
ifdef::openshift-rosa-hcp[]
There must be at least one machine pool without any taints and with at least two replicas.
endif::openshift-rosa-hcp[]
====
.Prerequisites
ifdef::openshift-rosa,openshift-rosa-hcp[]
* You installed and configured the latest AWS (`aws`), ROSA (`rosa`), and OpenShift (`oc`) CLIs on your workstation.
* You logged in to your Red{nbsp}Hat account by using the `rosa` CLI.
* You created a {product-title} cluster.
endif::openshift-rosa,openshift-rosa-hcp[]
ifndef::openshift-rosa,openshift-rosa-hcp[]
* You created an {product-title} cluster.
endif::[]
* You have an existing machine pool that does not contain any taints and contains at least two instances.
.Procedure
ifdef::openshift-rosa,openshift-rosa-hcp[]
. List the machine pools in the cluster by running the following command:
+
[source,terminal]
----
$ rosa list machinepools --cluster=<cluster_name>
----
+
.Example output
ifndef::openshift-rosa,openshift-rosa-hcp[]
[source,terminal]
----
ID AUTOSCALING REPLICAS INSTANCE TYPE LABELS TAINTS AVAILABILITY ZONES SPOT INSTANCES DISK SIZE SG IDs
Default No 2 m5.xlarge us-east-1a N/A 300 GiB sg-0e375ff0ec4a6cfa2
db-nodes-mp No 2 m5.xlarge us-east-1a No 300 GiB sg-0e375ff0ec4a6cfa2
----
endif::openshift-rosa,openshift-rosa-hcp[]
ifdef::openshift-rosa-hcp[]
[source,terminal]
----
ID AUTOSCALING REPLICAS INSTANCE TYPE LABELS TAINTS AVAILABILITY ZONE SUBNET VERSION AUTOREPAIR
workers No 2/2 m5.xlarge us-east-2a subnet-0df2ec3377847164f 4.16.6 Yes
db-nodes-mp No 2/2 m5.xlarge us-east-2a subnet-0df2ec3377847164f 4.16.6 Yes
----
endif::openshift-rosa-hcp[]
. Add or update the taints for a machine pool:
* To add or update taints for a machine pool that does not use autoscaling, run the following command:
+
[source,terminal]
----
$ rosa edit machinepool --cluster=<cluster_name> \
--taints=<key>=<value>:<effect>,<key>=<value>:<effect> \// <1>
<machine_pool_id>
----
<1> Replace `<key>=<value>:<effect>,<key>=<value>:<effect>` with a key, value, and effect for each taint, for example `--taints=key1=value1:NoSchedule,key2=value2:NoExecute`. Available effects include `NoSchedule`, `PreferNoSchedule`, and `NoExecute`.This list overwrites any modifications made to node taints on an ongoing basis.
+
The following example adds taints to the `db-nodes-mp` machine pool:
+
[source,terminal]
----
$ rosa edit machinepool --cluster=mycluster --replicas 2 --taints=key1=value1:NoSchedule,key2=value2:NoExecute db-nodes-mp
----
+
.Example output
[source,terminal]
----
I: Updated machine pool 'db-nodes-mp' on cluster 'mycluster'
----
.Verification
. Describe the details of the machine pool with the new taints:
+
[source,terminal]
----
$ rosa describe machinepool --cluster=<cluster_name> --machinepool=<machinepool_name>
----
+
.Example output
ifndef::openshift-rosa-hcp[]
[source,terminal]
----
ID: db-nodes-mp
Cluster ID: <ID_of_cluster>
Autoscaling: No
Replicas: 2
Instance type: m5.xlarge
Labels:
Taints: key1=value1:NoSchedule, key2=value2:NoExecute
Availability zones: us-east-1a
Subnets:
Spot instances: No
Disk size: 300 GiB
Security Group IDs:
----
endif::openshift-rosa-hcp[]
ifdef::openshift-rosa-hcp[]
[source,terminal]
----
ID: db-nodes-mp
Cluster ID: <ID_of_cluster>
Autoscaling: No
Desired replicas: 2
Current replicas: 2
Instance type: m5.xlarge
Labels:
Tags:
Taints: key1=value1:NoSchedule, key2=value2:NoExecute
Availability zone: us-east-2a
...
----
endif::openshift-rosa-hcp[]
. Verify that the taints are included for your machine pool in the output.
endif::[]