Skip to main content
In this lesson, you will learn how to deploy multiple schedulers in Kubernetes. We will go through the steps to identify the default scheduler, create and deploy a custom scheduler configuration, and finally run a pod using the new scheduler.

1. Identify the Default Scheduler

Begin by inspecting the cluster’s pods to identify the default Kubernetes scheduler pod. In most installations, the pod name is similar to kube-scheduler-controlplane. Use the following command to list all pods across namespaces:
Next, determine the image used by the default scheduler. Describe the scheduler pod in the kube-system namespace:
In the description output, look for an entry similar to:
This image will be necessary when configuring your custom scheduler.

2. Verify Service Account and Cluster Role Binding

Before deploying the custom scheduler, ensure that the service account and cluster role binding required for it are in place. Verify the service account with the following commands:
Since the necessary resources exist, you can proceed to the next step.

3. Create a ConfigMap for the Custom Scheduler Configuration

Create a configuration file for the custom scheduler at /root/my-scheduler-config.yaml with the following content:
You can verify the file content using:
Now, create a ConfigMap from this file in the kube-system namespace. Note that the correct flag is used rather than --name:
Verify that the ConfigMap was created successfully:
Ensure that the ConfigMap is correctly created and mounted to avoid configuration issues with your custom scheduler.

4. Deploy the Custom Scheduler

Deploy the custom scheduler using a manifest file (e.g., /root/my-scheduler.yaml). The manifest below deploys a custom scheduler pod using the same image as the default scheduler. Replace <use-correct-image> with k8s.gcr.io/kube-scheduler:v1.23.0 as shown:
Deploy the custom scheduler by running:
After deployment, confirm that all pods in the kube-system namespace are running as expected:
Always verify your deployment by checking the pod status, ensuring that no critical errors persist.

5. Create a Pod Using the Custom Scheduler

The final step involves creating a pod that explicitly uses the newly deployed custom scheduler. Below is an example manifest for an nginx pod. Notice that we specify schedulerName: my-scheduler to bind the pod to the custom scheduler:
Save this manifest to a file named nginx-pod.yaml, then create the pod:
Confirm that the pod is running as expected in the default namespace (or your desired namespace):

This completes the lab for deploying a custom scheduler in Kubernetes and scheduling a pod using that scheduler. For more detailed information on Kubernetes scheduling, please check out the Kubernetes Documentation.

Watch Video