Skip to content

Latest commit

 

History

History
50 lines (30 loc) · 1.46 KB

README.md

File metadata and controls

50 lines (30 loc) · 1.46 KB

{e,}scheduler

A Elixir toy scheduler for Kubernetes. It will randomly schedule your pod in some node.

This project is just a POC to test what Kelsey taught us on this awesome talk.

Prereqs

Define an annotated pod with the following annotation:

scheduler.alpha.kubernetes.io/name: escheduler

In case you don't know how to do it, check the examples/ folder.

And create it:

kubectl create -f examples/pod.yml

If we now get the list of pods we will see it as pending:

kubectl get pods
NAME      READY     STATUS    RESTARTS   AGE
custom    0/1       Pending   0          44s

Now let the magic begin!

Usage

We need a kubeproxy running to avoid auth problems and have an easy setup-able local communication with our cluster:

kubectl proxy
Starting to serve on 127.0.0.1:8001

If you are not familiarized with Elixir you can take a look to mix documentation, but in a nutshell:

mix escript.build

Will generate a executable called escheduler. Let the magic happen:

./escheduler
custom pod scheduled in gke-cluster-1-default-pool-f979b5a2-oqb1    

If you don't trust me you can check again:

kubectl get pods
NAME      READY     STATUS    RESTARTS   AGE
custom    1/1       Running   0          1m