MultipleSchedulers

Describe about Multiple Schedulers

In the Kubernetes we can create multiple schedulers by different way.

  1. Deploy additional Scheduler by using definition file (yaml)

  2. Depoly as Pod by using (pod template and scheduler config file)

# Pod Template
apiVersion: v1
kind: Pod
metadata:
  name: custom-scheduler
  namespace: kube-system
spec:
  # add this to specify scheduler name we use on Pod
  schedulerName: default-scheduler
  containers:
  - command:
    - /usr/local/bin/kube-scheduler
    - --config=/etc/kubernetes/my-scheduler/my-scheduler-config.yaml # (path to store config) 
    name: <scheduler_name>
    image: <image_scheduler>  
# Scheduler Config File
apiVersion: kubescheduler.config.k8s.io/v1
kind: KubeSchedulerConfiguration
profiles:

  - schedulerName: <scheduler_name>
  # we can have multiple profile in priority which scheduler will be run 
  # depend on the condition
  - schedulerName: default-scheduler
  - schedulerName: no-scoring-scheduler
    plugins:
      preScore:
        disabled:
        - name: '*'
      score:
        disabled:
        - name: '*
 # Optional when we have multiple scheduler run on multiple master node
 # This is leader which scheduler will be run first
 leaderElection:
   leaderElect: true
   resourceNamespace: kube-system
   resourceName: lock-object-my-scheduler 
  1. Deploy as Deployment can follow K8s Documentation

CheatSheet command

  1. View Schedulers: kubectl get pods -n kube-system

Last updated