Kubernetes ships with the default scheduler however it is possible to run multiple schedulers, including custom created schedulers, alongside each other and tell Kubernetes which one to use for your pods.
Steps to run a second scheduler:
- Create container image for the new scheduler
- Create spec for the container for deploying onto your cluster. Best practice is to run it inside a deployment so that it benefits from availability. The spec must contain a unique name for the new scheduler as the value passed to the command run inside the container to create the new scheduler and assign a service account bound to the cluster role system:kube-scheduler to grant it the same privileges as the default scheduler.
- Deploy the deployment
When deploying pods the scheduler chosen depends on the use of the schedulerName: value in the spec of the pod.
- If the schedulerName: value is not set then the default scheduler is used as per normal
- If the schedulerName: value is set to default-scheduler then the default scheduler is used
- If the schedulerName: value is set to the name provided to the command in the second scheduler spec then the second scheduler is used
You can check which scheduler was used to schedule a pod using the scheduled entries in the event logs
kubectl get events