Custom Scheduling

You are viewing documentation for a release that is no longer supported. The latest supported version of version 3 is [3.11]. For the most recent version 4, see [4]

You are viewing documentation for a release that is no longer supported. The latest supported version of version 3 is [3.11]. For the most recent version 4, see [4]

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

    1. apiVersion: v1
    2. kind: Pod
    3. metadata:
    4. name: custom-scheduler
    5. labels:
    6. name: multischeduler-example
    7. spec:
    8. schedulerName: custom-scheduler (1)
    9. containers:
    10. - name: pod-with-second-annotation-container
    11. image: docker.io/ocpqe/hello-pod
    1The 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:

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

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

    1. $ oc get pod

    The pod should not be running.

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

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

    1. $ oc get pod

    The pod should be running.

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

    1. $ oc describe pod custom-scheduler

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

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