Configuring a Node Selector for a Project

If the cluster administrator does not want developers controlling the node selector for their pods, then a default node selector should be configured in the project resource. A cluster administrator can either define a node selector when a project is created, or can add or update a node selector after a project is created.

Use the oc adm new-project command to add the node selector at project creation. For example, the following command creates a new project named demo, where all pods will be deployed to nodes that have the label of tier=1.

oc adm new-project demo --node-selector "tier=1"

To configure a default node selector for an existing project, add an annotation to the namespace resource with the openshift.io/node-selector key. The oc annotate command can add, modify, or remove a node selector annotation:

oc annotate namespace demo \
> openshift.io/node-selector="tier=2" --overwrite
Daftar Materi