1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 00:48:01 +01:00
Files
openshift-docs/modules/nodes-scheduler-default-modifying.adoc
2020-08-07 16:17:38 -04:00

162 lines
4.8 KiB
Plaintext

// Module included in the following assemblies:
//
// * nodes/nodes-scheduler-default.adoc
[id="nodes-scheduler-default-modifying_{context}"]
= Modifying scheduler policies
//Made changes to this file to match https://github.com/openshift/openshift-docs/pull/13626/files#diff-ba6ab177a3e2867eaefe07f48bd6e158
You change scheduling behavior by creating or editing your scheduler policy ConfigMap in the `openshift-config` project.
Add and remove predicates and priorities to the ConfigMap to create a _scheduler policy_.
.Procedure
To modify the current custom scheduling, use one of the following methods:
* Edit the scheduler policy ConfigMap:
+
[source,terminal]
----
$ oc edit configmap <configmap-name> -n openshift-config
----
+
For example:
+
[source,terminal]
----
$ oc edit configmap scheduler-policy -n openshift-config
----
+
.Example output
[source,yaml]
----
apiVersion: v1
data:
policy.cfg: |
{
"kind" : "Policy",
"apiVersion" : "v1",
"predicates" : [ <1>
{"name" : "MaxGCEPDVolumeCount"},
{"name" : "GeneralPredicates"},
{"name" : "MaxAzureDiskVolumeCount"},
{"name" : "MaxCSIVolumeCountPred"},
{"name" : "CheckVolumeBinding"},
{"name" : "MaxEBSVolumeCount"},
{"name" : "MatchInterPodAffinity"},
{"name" : "CheckNodeUnschedulable"},
{"name" : "NoDiskConflict"},
{"name" : "NoVolumeZoneConflict"},
{"name" : "PodToleratesNodeTaints"}
],
"priorities" : [ <2>
{"name" : "LeastRequestedPriority", "weight" : 1},
{"name" : "BalancedResourceAllocation", "weight" : 1},
{"name" : "ServiceSpreadingPriority", "weight" : 1},
{"name" : "NodePreferAvoidPodsPriority", "weight" : 1},
{"name" : "NodeAffinityPriority", "weight" : 1},
{"name" : "TaintTolerationPriority", "weight" : 1},
{"name" : "ImageLocalityPriority", "weight" : 1},
{"name" : "SelectorSpreadPriority", "weight" : 1},
{"name" : "InterPodAffinityPriority", "weight" : 1},
{"name" : "EqualPriority", "weight" : 1}
]
}
kind: ConfigMap
metadata:
creationTimestamp: "2019-09-17T17:44:19Z"
name: scheduler-policy
namespace: openshift-config
resourceVersion: "15370"
selfLink: /api/v1/namespaces/openshift-config/configmaps/scheduler-policy
----
<1> Add or remove predicates as needed.
<2> Add, remove, or change the weight of predicates as needed.
+
It can take a few minutes for the scheduler to restart the pods with the updated policy.
* Change the policies and predicates being used:
. Remove the scheduler policy ConfigMap:
+
[source,terminal]
----
$ oc delete configmap -n openshift-config <name>
----
+
For example:
+
[source,terminal]
----
$ oc delete configmap -n openshift-config scheduler-policy
----
. Edit the `policy.cfg` file to add and remove policies and predicates as needed.
+
For example:
+
[source,terminal]
----
$ vi policy.cfg
----
+
.Example output
[source,yaml]
----
apiVersion: v1
data:
policy.cfg: |
{
"kind" : "Policy",
"apiVersion" : "v1",
"predicates" : [
{"name" : "MaxGCEPDVolumeCount"},
{"name" : "GeneralPredicates"},
{"name" : "MaxAzureDiskVolumeCount"},
{"name" : "MaxCSIVolumeCountPred"},
{"name" : "CheckVolumeBinding"},
{"name" : "MaxEBSVolumeCount"},
{"name" : "MatchInterPodAffinity"},
{"name" : "CheckNodeUnschedulable"},
{"name" : "NoDiskConflict"},
{"name" : "NoVolumeZoneConflict"},
{"name" : "PodToleratesNodeTaints"}
],
"priorities" : [
{"name" : "LeastRequestedPriority", "weight" : 1},
{"name" : "BalancedResourceAllocation", "weight" : 1},
{"name" : "ServiceSpreadingPriority", "weight" : 1},
{"name" : "NodePreferAvoidPodsPriority", "weight" : 1},
{"name" : "NodeAffinityPriority", "weight" : 1},
{"name" : "TaintTolerationPriority", "weight" : 1},
{"name" : "ImageLocalityPriority", "weight" : 1},
{"name" : "SelectorSpreadPriority", "weight" : 1},
{"name" : "InterPodAffinityPriority", "weight" : 1},
{"name" : "EqualPriority", "weight" : 1}
]
}
----
. Re-create the scheduler policy ConfigMap based on the scheduler JSON file:
+
[source,terminal]
----
$ oc create configmap -n openshift-config --from-file=policy.cfg <configmap-name> <1>
----
<1> Enter a name for the ConfigMap.
+
For example:
+
[source,terminal]
----
$ oc create configmap -n openshift-config --from-file=policy.cfg scheduler-policy
----
+
.Example output
[source,terminal]
----
configmap/scheduler-policy created
----