mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 21:46:22 +01:00
129 lines
6.1 KiB
Plaintext
129 lines
6.1 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * nodes/nodes/rosa-managing-worker-nodes.adoc
|
|
|
|
:_content-type: PROCEDURE
|
|
[id="rosa-adding-taints_{context}"]
|
|
= Adding taints to a machine pool
|
|
|
|
You can add taints for compute (also known as worker) nodes in a machine pool to control which pods are scheduled to them. When you apply a taint to a machine pool, the scheduler cannot place a pod on the nodes in the pool unless the pod specification includes a toleration for the taint.
|
|
|
|
.Prerequisites
|
|
|
|
ifdef::openshift-rosa[]
|
|
* You installed and configured the latest AWS (`aws`), ROSA (`rosa`), and OpenShift (`oc`) CLIs on your workstation.
|
|
* You logged in to your Red Hat account by using the `rosa` CLI.
|
|
* You created a {product-title} (ROSA) cluster.
|
|
endif::openshift-rosa[]
|
|
ifndef::openshift-rosa[]
|
|
* You created an {product-title} cluster.
|
|
endif::[]
|
|
* You have an existing machine pool.
|
|
|
|
.Procedure
|
|
|
|
ifdef::openshift-rosa[]
|
|
. List the machine pools in the cluster:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ rosa list machinepools --cluster=<cluster_name>
|
|
----
|
|
+
|
|
.Example output
|
|
+
|
|
[source,terminal]
|
|
----
|
|
ID AUTOSCALING REPLICAS INSTANCE TYPE LABELS TAINTS AVAILABILITY ZONES SPOT INSTANCES
|
|
Default No 2 m5.xlarge us-east-1a N/A
|
|
db-nodes-mp No 2 m5.xlarge us-east-1a No
|
|
----
|
|
|
|
. 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> \
|
|
--replicas=<replica_count> \ <1>
|
|
--taints=<key>=<value>:<effect>,<key>=<value>:<effect> \ <2>
|
|
<machine_pool_id>
|
|
----
|
|
<1> For machine pools that do not use autoscaling, you must provide a replica count when adding taints. If you do not specify the `--replicas` argument, you are prompted for a replica count before the command completes. If you deployed {product-title} (ROSA) using a single availability zone, the replica count defines the number of compute nodes to provision to the machine pool for the zone. If you deployed your cluster using multiple availability zones, the count defines the total number of compute nodes in the machine pool across all zones and must be a multiple of 3.
|
|
<2> 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'
|
|
----
|
|
|
|
* To add or update taints for a machine pool that uses autoscaling, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ rosa edit machinepool --cluster=<cluster_name> \
|
|
--min-replicas=<minimum_replica_count> \ <1>
|
|
--max-replicas=<maximum_replica_count> \ <1>
|
|
--taints=<key>=<value>:<effect>,<key>=<value>:<effect> \ <2>
|
|
<machine_pool_id>
|
|
----
|
|
<1> For machine pools that use autoscaling, you must provide minimum and maximum compute node replica limits. If you do not specify the arguments, you are prompted for the values before the command completes. The cluster autoscaler does not reduce or increase the machine pool node count beyond the limits that you specify. If you deployed ROSA using a single availability zone, the `--min-replicas` and `--max-replicas` arguments define the autoscaling limits in the machine pool for the zone. If you deployed your cluster using multiple availability zones, the arguments define the autoscaling limits in total across all zones and the counts must be multiples of 3.
|
|
<2> 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 --min-replicas=2 --max-replicas=3 --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
|
|
|
|
. List the available machine pools in your cluster:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ rosa list machinepools --cluster=<cluster_name>
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
ID AUTOSCALING REPLICAS INSTANCE TYPE LABELS TAINTS AVAILABILITY ZONES SPOT INSTANCES
|
|
Default No 2 m5.xlarge us-east-1a N/A
|
|
db-nodes-mp No 2 m5.xlarge key1=value1:NoSchedule, key2=value2:NoExecute us-east-1a No
|
|
----
|
|
|
|
. Verify that the taints are included for your machine pool in the output.
|
|
endif::[]
|
|
|
|
ifdef::openshift-dedicated[]
|
|
. Navigate to {cluster-manager-url} and select your cluster.
|
|
. Under the *Machine pools* tab, click the options menu {kebab} for the machine pool that you want to add a taint to.
|
|
. Select *Edit taints*.
|
|
. Add *Key* and *Value* entries for your taint.
|
|
. Select an *Effect* for your taint from the drop-down menu. Available options include `NoSchedule`, `PreferNoSchedule`, and `NoExecute`.
|
|
. Select *Add taint* if you want to add more taints to the machine pool.
|
|
. Click *Save* to apply the taints to the machine pool.
|
|
|
|
.Verification
|
|
|
|
. Under the *Machine pools* tab, select *>* next to your machine pool to expand the view.
|
|
. Verify that your taints are listed under *Taints* in the expanded view.
|
|
endif::[]
|