How to change weight of priorities in Kubernetes Scheduler?

7/24/2019

I want to increase the performance of the Kubernetes scheduler by changing the weight of the priorities (or eliminate some priorities), I want to know how I can change the weight of the priorities in the scheduler? and what is a default scoring strategy used by kubernetes?

-- ali saaad
kubernetes
scheduler

2 Answers

7/25/2019

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/v1
kind: PriorityClass
metadata:
  name: high-priority
value: 1000000
globalDefault: false
description: "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: v1
kind: Pod
metadata:
  name: nginx
  labels:
    env: test
spec:
  containers:
  - name: nginx
    image: nginx
    imagePullPolicy: IfNotPresent
  priorityClassName: high-priority

For more detailed informatio, please check documentation.

-- PjoterS
Source: StackOverflow

9/16/2019

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.

-- kz28
Source: StackOverflow