Below are some instructions for testing out the custom scheduler using minikube.
- Ensure you have minikube installed (see docs)
- Start a new multi-node cluster
minikube start --nodes 3 -p custom-scheduler-demo
- We need to enable the minikube registry plugin to be able to deploy our custom scheduler container:
minikube addons enable registry -p custom-scheduler-demo
- We also need to enable insecure registries so that we can push images without needing to provision TLS certificates (this should be run in a separate terminal):
docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip -p custom-scheduler-demo):5000"
- Next, we can build and push our custom scheduler container to the registry in minikube:
docker build --tag localhost:5000/custom-scheduler . docker push localhost:5000/custom-scheduler
- Deploy our custom scheduler:
kubectl apply -f deploy/custom-scheduler.yaml
- Since the custom scheduler expects there to be a
nodeGroup
label on the nodes, we need to add these using:kubectl label nodes custom-scheduler-demo-m02 nodeGroup=1 kubectl label nodes custom-scheduler-demo-m03 nodeGroup=2
- Deploy two demo apps (these are just taken from the minikube tutorial):
kubectl apply -f demo/demo-app.yaml
- Verify it all worked. Since each of the app's deployments has a different
nodeGroup
label, you should see all pods fromhello-minikube-1
deployed to nodecustom-scheduler-demo-m02
and all pods fromhello-minikube-2
deployed to nodecustom-scheduler-demo-m03
:kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES hello-minikube-1-7bc54fdc74-2vrlg 1/1 Running 0 66s 10.244.1.16 custom-scheduler-demo-m02 <none> <none> hello-minikube-1-7bc54fdc74-zms9g 1/1 Running 0 67s 10.244.1.15 custom-scheduler-demo-m02 <none> <none> hello-minikube-2-569d97b8bf-cqtjm 1/1 Running 0 64s 10.244.2.15 custom-scheduler-demo-m03 <none> <none> hello-minikube-2-569d97b8bf-pp9dx 1/1 Running 0 62s 10.244.2.16 custom-scheduler-demo-m03 <none> <none>