What will be custom scheduler name in kubernetes

11/30/2018

I have ran service account and pod for custom scheduler.so what will be my custom scheduler name ?it will be pod name or service name or anything else.

-- Vivek Hegade M S
kubernetes

1 Answer

11/30/2018

Generally, you define your scheduler name while writing the scheduler itself. Then you create a docker container for scheduler and ran that scheduler as deployment in kubernetes.

Now that scheduler will schedule your pods (based on how you write your scheduling).

You should watch the following talk of Kelsey Hightower on how to write custom scheduler and use it

https://www.youtube.com/watch?v=IYcL0Un1io0

Here is the toy scheduler source code, you can refer

https://github.com/kelseyhightower/scheduler

Hope this gives you brief idea.

EDIT:

The kelsey hightower's scheduler (link mentioned above) has to be deployed in following way:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: scheduler
  name: scheduler
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: scheduler
      name: scheduler
    spec:
      containers:
        - name: scheduler
          image: kelseyhightower/scheduler:0.4.0
        - name: kubectl
          image: kelseyhightower/kubectl:1.3.4
          args:
            - "proxy"

Then whenever you deploy new pods with that scheduler you need to provide `schedulerName' in yaml file:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx
      name: nginx
    spec:
      schedulerName: hightower
      containers:
        - name: nginx
          image: "nginx:1.11.1-alpine"
          resources:
            requests:
              cpu: "500m"
              memory: "128M"

That schedulerName should be the name of the scheduler define in your code.

-- Prafull Ladha
Source: StackOverflow