How to add a new scheduler priority to the default kubernetes scheduler?

11/29/2016

Kubernetes scheduler includes two parts: predicate and priority. The source code is in kubernetes/plugin/pkg/scheduler. I want to add a new priority algorithm to the default priorities. Can anyone guide me the detailed steps? Thanks a lot!

Maybe I should do the following steps:

  1. Add my own priority algorithm to the path: kubernetes/plugin/pkg/scheduler/algorithm/priorities
  2. Register that priority algorithm
  3. Build/Recompile the whole k8s project and install\deploy a new k8s cluster
  4. Test if that priority effects, maybe give it a high weight.

If there are more detailed articles and documents, it will help me a lot! The more detailed the better!Thanks a lot!

k8s version: 1.2.0, 1.4.0 or later.

-- urey
algorithm
kubernetes
scheduler
scheduling

1 Answer

11/29/2016

You can run your scheduler as a kubernetes deployment.

Kelsey Hightower has an example scheduler coded up on Github

The meat and bones of this is here: https://github.com/kelseyhightower/scheduler/blob/master/bestprice.go

And the deployment yaml is here

Essentially, you can package it up as a docker container and deploy it.

Take note of the way you interact with the k8s API using this package in order to do it this way you'll need to have a similar wrapper, but it's much easier than building/recompiling the whole k8s package.

-- jaxxstorm
Source: StackOverflow