A Kubernetes Scheduer Extender with two Customed Scheduling Algorithms BNP and CMDN.
Kubernetes has become the de-facto container cluster management system with its rich enterprise and production-level features. However, Kubernetes' default scheduling algorithms are designed for general scenarios. For customed scenarios, this project proposes a scheduler extender named Liang
and implements two example algorithms BNP and CMDN.
Config file for kubernetes scheduler is:
{
"kind": "Policy",
"apiVersion": "v1",
"extenders": [
{
"urlPrefix": "http://localhost:8000/v1",
"prioritizeVerb": "prioritizeVerb",
"weight": 1,
"enableHttps": false,
"httpTimeout": 1000000000,
"nodeCacheCapable": true,
"ignorable": false
}
]
}
Note: This section used default data for run liang, it's just a demo. You should not change default config in config/
directions.
- build binary
go build cmd/main.go
- run binary in shell
./main -conf configs -log.v 7
- request
localhost:8000/v1/prioritizeVerb
use cURLcurl --location --request POST 'localhost:8000/v1/prioritizeVerb' \ --header 'Content-Type: application/json' \ --data-raw '{ "Pod": { "metadata": { "creationTimestamp": null, "annotations": { "LiangNetIO": "80" } }, "spec": { "containers": null }, "status": {} }, "Nodes": null, "NodeNames": [ "node1", "node2", "node3" ] }'
You will see sample output like:
[{"Host":"node1","Score":0},{"Host":"node2","Score":51},{"Host":"node3","Score":100}]
BNP adds network IO resource request and combines the network information of candidate nodes to select the best node. BNP makes the overall network IO usage of the cluster more balanced and reduces the container deployment time.
Multi-criteria resources scheduling algorithm CMDN is based on TOPSIS decision algorithm. The CMDN algorithm takes CPU utilization, memory utilization, disk IO, network IO and NIC bandwidth of candidate nodes into account. It then scores nodes comprehensively using TOPSIS algorithm which brings two scheduling effects of multi-criteria resource balancing and compactness.
The experiments show that BNP Algorithm improves the balance level of cluster network IO, prevents nodes from network IO bottlenecks, and also reduces the container deployment time by 32%. The CMDN Algorithm can balance the multi-criteria resource utilization such as CPU, Memory, disk IO and network IO of the cluster nodes in balancing policy. It also reduces container deployment time by 21%. The CMDN Algorithm can schedule containers to the nodes with high multidi-criteria resource utilization in the compact policy which achieves the expected results.
- compile binary
go build cmd/main.go
- change configs in configs/applications.toml if needed
- run binary
./main -conf configs