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 tokube-scheduler-controlplane. Use the following command to list all pods across namespaces:
kube-system namespace:
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: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:
kube-system namespace. Note that the correct flag is used rather than --name:
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:
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 specifyschedulerName: my-scheduler to bind the pod to the custom scheduler:
nginx-pod.yaml, then create the pod:
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.