OpenShift Node Selector Operations
Operations to manipulate node selectors.
Configuring a Cluster-Wide Default Node Selector
Sets up a cluster-wide default node selector:
- Edit the master configuration file /etc/origin/master/master-config.yaml and add or modify the value for the default node selector:
... projectConfig: defaultNodeSelector: "color=red,flavor=vanilla" ...
The master must be restarted to change to take effect:
Configuring a Per-Project Node Selector
When the Project is Created
The per-project node selector can be set up when the project is created:
oadm new-project <project-name> --node-selector='keyA=valueA,keyB=valueB'
More details in:
After the Project was Created
The node selector can be added after the project was created by editing the namespace metadata with oc edit:
oc edit namespace <my-project>
... metadata: annotations: openshift.io/node-selector: "env=infra" ...
Edit the "namespace", and not the "project", if attempting to edit the project you will get an error message saying that the field is immutable.
Configuring a Per-Pod Node Selector
A per-pod node selector is generated when the pod is created, according to the rules specified here: