How to change weight of priorities in Kubernetes Scheduler? How to change weight of priorities in Kubernetes Scheduler? kubernetes kubernetes

How to change weight of priorities in Kubernetes Scheduler?


I think this file has defined the default policies: github source. You can modify the default policies and weights by passing a policy-config file (example) with --policy-config-file option to kube-scheduler.


Kubernetes 1.14 introduced stable prioritization of the nodes (Priority is enabled by default in Kubernetes 1.14+).

To give priority you have to create Priority Class and later use it in YAML. A PriorityClass object can have any 32-bit integer value smaller than or equal to 1 billion. Larger numbers are reserved for critical system Pods. Below example of creating PriorityClass

apiVersion: scheduling.k8s.io/v1kind: PriorityClassmetadata:  name: high-priorityvalue: 1000000globalDefault: falsedescription: "This priority class should be used for XYZ service pods only."

Later you have to include priorityClassName in your YAML under spec section like below:

apiVersion: v1kind: Podmetadata:  name: nginx  labels:    env: testspec:  containers:  - name: nginx    image: nginx    imagePullPolicy: IfNotPresent  priorityClassName: high-priority

For more detailed informatio, please check documentation.