mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-07 00:48:01 +01:00
Merge pull request #35944 from openshift-cherrypick-robot/cherry-pick-35894-to-enterprise-4.9
[enterprise-4.9] BZ-1979431: Adding link to configuring project node selectors
This commit is contained in:
@@ -42,6 +42,8 @@ $ oc get nodes
|
||||
If the default node selector key conflicts with the key of a pod's label, then the default node selector is not applied.
|
||||
|
||||
However, do not set a default node selector that might cause a pod to become unschedulable. For example, setting the default node selector to a specific node role, such as `node-role.kubernetes.io/infra=""`, when a pod's label is set to a different node role, such as `node-role.kubernetes.io/master=""`, can cause the pod to become unschedulable. For this reason, it is not recommended to set the default node selector to specific node roles.
|
||||
|
||||
You can alternatively use a project node selector to avoid cluster-wide node selector key conflicts.
|
||||
====
|
||||
|
||||
.. Edit the `Scheduler` object:
|
||||
@@ -64,7 +66,7 @@ spec:
|
||||
defaultNodeSelector: node-role.kubernetes.io/app= <1>
|
||||
...
|
||||
----
|
||||
<1> This example node selector deploys pods on worker nodes by default.
|
||||
<1> This example node selector deploys pods on app nodes by default.
|
||||
|
||||
.. Save the file to apply the changes.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ You can use a node selector to place specific pods on specific nodes, cluster-wi
|
||||
|
||||
For example, as a cluster administrator, you can create an infrastructure where application developers can deploy pods only onto the nodes closest to their geographical location by including a node selector in every pod they create. In this example, the cluster consists of five data centers spread across two regions. In the U.S., label the nodes as `us-east`, `us-central`, or `us-west`. In the Asia-Pacific region (APAC), label the nodes as `apac-east` or `apac-west`. The developers can add a node selector to the pods they create to ensure the pods get scheduled on those nodes.
|
||||
|
||||
A pod is not scheduled if the `Pod` object contains a node selector, but no node has a matching label.
|
||||
A pod is not scheduled if the `Pod` object contains a node selector, but no node has a matching label.
|
||||
|
||||
[IMPORTANT]
|
||||
====
|
||||
@@ -35,7 +35,7 @@ To use node selectors and labels, first label the node to avoid pods being desch
|
||||
You cannot add a node selector directly to an existing scheduled pod. You must label the object that controls the pod, such as deployment config.
|
||||
====
|
||||
+
|
||||
For example, the following `Node` object has the `region: east` label:
|
||||
For example, the following `Node` object has the `region: east` label:
|
||||
+
|
||||
ifndef::openshift-origin[]
|
||||
.Sample `Node` object with a label
|
||||
@@ -112,7 +112,7 @@ When you create the pod using the example pod spec, it can be scheduled on the e
|
||||
Default cluster-wide node selectors::
|
||||
+
|
||||
With default cluster-wide node selectors, when you create a pod in that cluster, {product-title} adds the default node selectors to the pod and schedules
|
||||
the pod on nodes with matching labels.
|
||||
the pod on nodes with matching labels.
|
||||
+
|
||||
For example, the following `Scheduler` object has the default cluster-wide `region=east` and `type=user-node` node selectors:
|
||||
+
|
||||
@@ -144,7 +144,7 @@ metadata:
|
||||
region: east
|
||||
type: user-node
|
||||
...
|
||||
----
|
||||
----
|
||||
+
|
||||
.Example `Pod` object with a node selector
|
||||
[source,terminal]
|
||||
@@ -173,6 +173,7 @@ pod-s1 1/1 Running 0 20s 10.131.2.6 ci-ln-qg1il3k-f76d1-hlm
|
||||
If the project where you create the pod has a project node selector, that selector takes preference over a cluster-wide node selector. Your pod is not created or scheduled if the pod does not have the project node selector.
|
||||
====
|
||||
|
||||
[id="project-node-selectors_{context}"]
|
||||
Project node selectors::
|
||||
+
|
||||
With project node selectors, when you create a pod in this project, {product-title} adds the node selectors to the pod and schedules the pods on a node with matching labels. If there is a cluster-wide default node selector, a project node selector takes preference.
|
||||
@@ -205,7 +206,7 @@ metadata:
|
||||
region: east
|
||||
type: user-node
|
||||
...
|
||||
----
|
||||
----
|
||||
+
|
||||
When you create the pod using the example pod spec in this example project, the pod is created with the project node selectors and is scheduled on the labeled node:
|
||||
+
|
||||
@@ -246,4 +247,3 @@ spec:
|
||||
|
||||
....
|
||||
----
|
||||
|
||||
|
||||
@@ -513,6 +513,10 @@ include::modules/machineset-creating.adoc[leveloffset=+2]
|
||||
|
||||
include::modules/creating-an-infra-node.adoc[leveloffset=+2]
|
||||
|
||||
.Additional resources
|
||||
|
||||
* For information on how to configure project node selectors to avoid cluster-wide node selector key conflicts, see xref:../nodes/scheduling/nodes-scheduler-node-selectors.adoc#project-node-selectors_nodes-scheduler-node-selectors[Project node selectors].
|
||||
|
||||
include::modules/creating-infra-machines.adoc[leveloffset=+2]
|
||||
|
||||
.Additional resources
|
||||
|
||||
Reference in New Issue
Block a user