OpenShift - Label a node using the oc label command
by
Jeremy Canfield |
Updated: October 27 2022
| OpenShift articles
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
I like to think of a "machine" as OpenShift representation of a Virtual Machine, such as an Amazon Web Services (AWS) EC2 Instance, or a VMWare Virtual Machine, and then a Node, and then the pods running on the node.
There are three types of nodes.
- edge
- master
- worker
The oc label node command can be used to apply one or more labels to a node. In this example, label region=east is applied to the node named worker-c4v5h.
~]$ oc label node worker-c4v5h region=east
node/worker-c4v5h labeled
And the oc describe node command can be used to see the labels that have been applied to the node.
~]$ oc describe node worker-c4v5h
Name: worker-c4v5h
Roles: infra,worker
Labels: region=east
And here is how you can remove a label. In this example, the region label will be removed.
~]$ oc label node worker-c4v5h region-
node/worker-c4v5h labeled
Did you find this article helpful?
If so, consider buying me a coffee over at