Skip to main content
In this lab you’ll add a second kube-scheduler to an existing Kubernetes cluster and use it to schedule a Pod. The overall flow:
  • Inspect the control-plane kube-scheduler to determine the exact scheduler image version.
  • Create a scheduler configuration (ConfigMap) for the new scheduler.
  • Deploy a Pod that runs a second kube-scheduler process using the same scheduler image.
  • Verify by creating a test Pod that requests the new scheduler via schedulerName.
Below are the step-by-step commands, manifests, and verification steps.

1) Locate the default kube-scheduler Pod and its image

List pods in the kube-system namespace and inspect the kube-scheduler Pod to discover the image tag used by the control-plane scheduler:
Example output (this is the image you should reuse for the custom scheduler):
Use the exact kube-scheduler image version used by the control-plane scheduler. Mismatched versions can cause incompatibilities between scheduler behavior and the control plane.

2) ServiceAccount and RBAC (verify before deploying)

This lab assumes a ServiceAccount and corresponding RBAC binding for the custom scheduler are already present in kube-system. Verify the ServiceAccount exists:
Example output:
If the ServiceAccount or RBAC (ClusterRole/ClusterRoleBinding) for the scheduler is missing, the scheduler will not be able to watch pods or perform bindings. Ensure you create a ClusterRole that allows the scheduler to list, watch, and get pods, and a ClusterRoleBinding that binds it to your my-scheduler ServiceAccount.

3) Create the scheduler configuration ConfigMap

Prepare a kube-scheduler configuration file. Example contents (this file is provided at /root/my-scheduler-config.yaml in the lab environment):
Create a ConfigMap from that config file in the kube-system namespace:
Verify the ConfigMap exists:
Example output:
This ConfigMap will be mounted into the scheduler Pod and referenced via the kube-scheduler --config flag.

4) Deploy the additional scheduler Pod

A Pod manifest is provided at /root/my-scheduler.yaml. Update it to use the exact kube-scheduler image discovered in step 1. Final my-scheduler.yaml:
Create the Pod:
Verify the Pod is running in the kube-system namespace:
Example output (the new scheduler Pod is present and Running):
Notes:
  • The custom scheduler Pod runs the kube-scheduler binary and reads configuration from the mounted file /etc/kubernetes/my-scheduler/my-scheduler-config.yaml.
  • The liveness/readiness probes target the scheduler health endpoint on port 10259 using HTTPS.

5) Create and schedule a Pod using the custom scheduler

To instruct Kubernetes to use the new scheduler for a Pod, set schedulerName in the Pod manifest to my-scheduler. Example nginx Pod manifest:
Create the Pod:
Verify scheduling and status:
If the custom scheduler has the required RBAC to bind pods and is functioning properly, the Pod should transition to the Running state. If it remains Pending:
  • Check events: kubectl describe pod nginx-customsched (look for “Scheduled” or scheduling errors).
  • Review the custom scheduler logs: kubectl logs my-scheduler -n kube-system.
  • Confirm the scheduler Pod has access to the API and the necessary RBAC permissions.

Quick reference table


Troubleshooting tips

  • If the custom scheduler Pod fails to start, check kubectl describe pod my-scheduler -n kube-system and kubectl logs my-scheduler -n kube-system.
  • If pods requesting schedulerName: my-scheduler are stuck in Pending, inspect events and scheduler logs to determine if the scheduler is receiving bind requests or being blocked by RBAC.
  • Ensure the scheduler image version matches the control-plane scheduler to avoid API/behavior mismatches.

That completes the lab steps to add a second scheduler and run a Pod using it.

Watch Video