You can use node selectors on pods and labels on nodes to control where the pod is scheduled. With node selectors, OpenShift Container Platform schedules the pods on nodes that contain matching labels.
You add labels to a node, a machine set, or a machine config. Adding the label to the machine set ensures that if the node or machine goes down, new nodes have the label. Labels added to a node or machine config do not persist if the node or machine goes down.
To add node selectors to an existing pod, add a node selector to the controlling object for that pod, such as a
Deployment object, or
Any existing pods under that controlling object are recreated on a node with a matching label. If you are creating a new pod, you can add the node selector directly to the
You cannot add a node selector directly to an existing scheduled pod.
To add a node selector to existing pods, determine the controlling object for that pod.
For example, the
router-default-66d5cf9464-m2g75 pod is controlled by the
$ oc describe pod router-default-66d5cf9464-7pwkc
Controlled By: ReplicaSet/router-default-66d5cf9464
The web console lists the controlling object under
ownerReferences in the pod YAML:
- apiVersion: apps/v1
Add labels to a node by using a machine set or editing the node directly: