OpenShift Node Selector Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(16 intermediate revisions by the same user not shown)
Line 2: Line 2:


* [[OpenShift Operations#Subjects|OpenShift Operations]]
* [[OpenShift Operations#Subjects|OpenShift Operations]]
* [[OpenShift Concepts#Node_Selector|OpenShift Concepts - Node Selectors]]


=Overview=
=Overview=
Line 9: Line 10:
=Configuring a Cluster-Wide Default Node Selector=
=Configuring a Cluster-Wide Default Node Selector=


{{External|https://docs.openshift.com/container-platform/3.5/admin_guide/managing_projects.html#setting-the-cluster-wide-default-node-selector}}
Sets up a [[OpenShift_Concepts#Cluster-Wide_Default_Node_Selector|cluster-wide default node selector]]:


Sets up a [[OpenShift_Concepts#Cluster-Wide_Default_Node_Selector|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:
 
{{Internal|OpenShift_Runtime#Restart_the_Master_Process|Restart the Master Process}}
 
==External Resources==
 
* https://docs.openshift.com/container-platform/3.5/admin_guide/managing_projects.html#setting-the-cluster-wide-default-node-selector


=Configuring a Per-Project Node Selector=
=Configuring a Per-Project Node Selector=


{{External|https://docs.openshift.com/container-platform/3.5/admin_guide/managing_projects.html#setting-the-project-wide-node-selector}}
==When the Project is Created==


The [[OpenShift Concepts#Per-Project_Node_Selector|per-project node selector]] can be set up when the project is created:
The [[OpenShift Concepts#Per-Project_Node_Selector|per-project node selector]] can be set up when the project is created:


  [[oadm new-project]] ''<project-name>'' --node-selector='keyA=valueA,keyB=valueB'
  [[OpenShift_Project_Operations#Per-Project_Node_Selector|oadm new-project]] ''<project-name>'' --node-selector='keyA=valueA,keyB=valueB'
 
More details in: {{Internal|OpenShift_Project_Operations#Per-Project_Node_Selector|OpenShift Project Operations}}
 
==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:
    <b>openshift.io/node-selector: "env=infra"</b>
...
 
{{Warn|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.}}
 
==External Resources==
 
* https://docs.openshift.com/container-platform/3.5/admin_guide/managing_projects.html#setting-the-project-wide-node-selector


=Configuring a Per-Pod Node Selector=
=Configuring a Per-Pod Node Selector=


{{External|https://docs.openshift.com/container-platform/3.5/admin_guide/managing_projects.html#developer-specified-node-selectors}}
A [[OpenShift Concepts#Per-Pod_Node_Selector|per-pod node selector]] is generated when the pod is created, according to the rules specified here:
 
{{Internal|OpenShift_Concepts#Per-Pod_Node_Selector|Per-Pod Node Selector}}
 
==External Resources==


The [[OpenShift Concepts#Per-Pod_Node_Selector|per-pod node selector]].
* https://docs.openshift.com/container-platform/3.5/admin_guide/managing_projects.html#developer-specified-node-selectors

Latest revision as of 23:00, 17 October 2017

Internal

Overview

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:

Restart the Master Process

External Resources

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:

OpenShift Project Operations

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.

External Resources

Configuring a Per-Pod Node Selector

A per-pod node selector is generated when the pod is created, according to the rules specified here:

Per-Pod Node Selector

External Resources