×

Overview

You can run multiple, custom schedulers alongside the default scheduler and configure which scheduler to use for each pods.

To schedule a given pod using a specific scheduler, specify the name of the scheduler in that pod specification.

Deploying the Scheduler

The steps below are the general process for deploying a scheduler into your cluster.

Information on how to create/deploy a scheduler is outside the scope of this document. For an example, see plugin/pkg/scheduler in the Kubernetes source directory.

  1. Create or edit a pod configuration and specify the name of the scheduler with the schedulerName parameter. The name must be unique.

    Sample pod specification with scheduler
    apiVersion: v1
    kind: Pod
    metadata:
      name: custom-scheduler
      labels:
        name: multischeduler-example
    spec:
      schedulerName: custom-scheduler (1)
      containers:
      - name: pod-with-second-annotation-container
        image: docker.io/ocpqe/hello-pod
    1 The name of the scheduler to use. When no scheduler name is supplied, the pod is automatically scheduled using the default scheduler.
  2. Run the following command to create the pod:

    $ oc create -f scheduler.yaml
  3. Run the following command to check that the pod was created with the custom scheduler:

    $ oc get pod custom-scheduler -o yaml
  4. Run the following command to check the status of the pod:

    $ oc get pod

    The pod should not be running.

    NAME                READY     STATUS    RESTARTS   AGE
    custom-scheduler    0/1       Pending    0         2m
  5. Deploy the custom scheduler.

  6. Run the following command to check the status of the pod:

    $ oc get pod

    The pod should be running.

    NAME                READY     STATUS    RESTARTS   AGE
    custom-scheduler    1/1       Running    0         4m
  7. Run the following command to check that the scheduler was used:

    $ oc describe pod custom-scheduler

    The name of the scheduler is listed, as shown in the following truncated output:

    [...]
    Events:
      FirstSeen  LastSeen  Count  From              SubObjectPath  Type       Reason Message
      ---------  --------  -----  ----              -------------  --------   ------ -------
      1m         1m        1      my-scheduler      Normal         Scheduled  Successfully assigned custom-scheduler to <$node1>
    [...]