Kubernetes(k8s) currently schedules pods based on cpu, memory resources. k8s uses flat networking, the pod pecification doesn’t carry any networking requirements. Hence networking is not a scheduling constraint. Similarly, storage is network attached and hence not a scheduling constraint. To help enrterprise applications achieve consistent performance, I/O (storage & network) and QoS are also important considerations for the scheduler. This started us down the path of exploring extensibility options for the k8s scheduler.
We had come up with the following requirements for the Scheduler Extender:
The Details (From #13580)
There are three ways to add new scheduling rules (predicates and priority functions) to Kubernetes:
The third approach is needed for use cases where scheduling decisions need to be made on resources not directly managed by the standard Kubernetes scheduler. The extender helps make scheduling decisions based on such resources. (Note that the three approaches are not mutually exclusive.)
When scheduling a pod, the extender allows an external process to filter and prioritize nodes. k8s scheduler policy file allows configuration for the extender.
A sample scheduler policy file with extender configuration:
Arguments passed to the FilterVerb endpoint on the extender are the set of nodes filtered through the k8s predicates and the pod. Arguments passed to the PrioritizeVerb endpoint on the extender are the set of nodes filtered through the k8s predicates and extender predicates and the pod.
The “filter” call returns a list of nodes (api.NodeList). The “prioritize” call returns priorities for each node (schedulerapi.HostPriorityList).
The “filter” call may prune the set of nodes based on its predicates. Scores returned by the “prioritize” call are added to the k8s scores (computed through its priority functions) and used for final host selection.
Multiple extenders can be configured in the scheduler policy.