Appendix C. Applying labels and taints to Red Hat OpenShift node
In order to have our control pods run on a dedicated Red Hat OpenShift node, one must set the appropriate labels and taints to the specified node.
In this example, we will select one of our Red Hat OpenShift nodes with the role worker
the label aap_node_type=control
.
Get the name of one of the nodes you want to label running
$ oc get nodes
-
Choose a node from the list and note its name, e.g.
worker1
Apply the
aap_node_type=control
label to the node$ oc label node <node-name> aap_node_type=control
NoteReplace
<node-name>
with the name of the node you want to label.Verify the creation of the label as follows:
$ oc get nodes --show-labels | grep <node-name>
With the label created, the next step is to add a
NoSchedule
taint to the worker node we have already created a label for.The following command adds a
NoSchedule
taint to our node:oc adm taint nodes <node-name> dedicated=AutomationController:NoSchedule
dedicated
: This is the key of the taint that is an arbitrary string supplied that identifies the taint.AutomationController
: This is an arbitrary value given to the taint.NoSchedule
: This is the effect of the taint which specifies no pods that don’t tolerate this taint will be scheduled onto this node.By applying this taint to our node, we are telling the Kubernetes scheduler to reserve this node for certain types of workloads that tolerate the taint. In this case, we are reserving the node for workloads with the dedicated=AutomationController toleration.
Verify the taint has been applied
$ oc get nodes \ -o jsonpath='{range.items[*]}{@.metadata.name}{"\t"}{@.spec.taints[*].key}:{@.spec.taints[*].value}{"\n"}{end}' \ | grep AutomationController