You need Go version v1.10 or higher.
To build, make sure Go dependencies are installed.
To get dependencies, run go get -d ./...
if it does not work, install package separately
(kuberenetes client-go)
go get k8s.io/client-go/...
go get -u k8s.io/apimachinery/...
(prometheus client-go)
go get github.com/prometheus/..
Verify for below folders of Kubernetes client-go library and prometheus after running above commands
$GOPATH/src/k8s.io/client-go/
$GOPATH/src/github.com/prometheus/
Update URLs for the Prometheus server in the file kubernetes-client/scheduler.go in the variables: promeMonitorAdr and promeIstioAdr
Custom scheduling algorithm reads the tags of the machines in the cluster to make scheduling decisions. To add a tag to machine, run kubectl label nodes ${node_name} VM=${VMn} PM=${PMn} RM=${RMn}
.
cd kubernetes-client
make build
- Run
kubectl create namespace athena
- To deploy using default Kubernetes scheduler, run
make rund
- To deploy using custom scheduler, run
make runa
- Run
kubectl create namespace athena
- To deploy using default Kubernetes scheduler, run
make runrobod
- To deploy using custom scheduler, run
make runroboa
To test the application from outside the Kubernetes cluster, we need to do port forwarding.
For benchmark application:
Port forwarding - kubectl port-forward svc/server-a-service ${port A}:8090 -n athena
To test,send GET http request to http://{url}:${port A}/a
For Robot Shop applcation:
Port forwarding - kubectl port-forward svc/web ${port B}:8080 -n athena
To test, send GET http request to http://{url}:${port B}/add/anonymous-99/K9/1
File kubernetes-client/scheduler.go contains algorithm of our custom scheduler and below are description about the code:
- curServices and curNodes store the node and service information of the cluster.
- func schedule() is called periodically for re-scheduling. All scheduling code goes in this function.
- CreateDeployment(), UpdateDeployment(), DeleteDeployment() and BindPodToNode() make API calls to propagate scheduling decisions.
- ListDeployment() and ListNode() make API calls to get cluster status information.
- generateMockData() is used to generate mock data for testing.