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.

  1. Get the name of one of the nodes you want to label running

    $ oc get nodes
  2. Choose a node from the list and note its name, e.g. worker1
  3. Apply the aap_node_type=control label to the node

    $ oc label node <node-name> aap_node_type=control
    Note

    Replace <node-name> with the name of the node you want to label.

  4. 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.

  5. 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
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.