Huang-Wei / sample-scheduler-extender

a sample to showcase how to create a k8s scheduler extender
Apache License 2.0
56 stars 48 forks source link

How to apply this schedule extender to kind Kubernetes cluster #5

Open srini1978 opened 4 years ago

srini1978 commented 4 years ago

Hi, I am running a Kubernetes cluster using kind. To apply the schedule extender policy.json i need to apply this to kube-scheduler . however i am getting a kube-scheduler: command not found

I am trying to use the same extender logic for kube-scheduler. How will "kind" be able to work with this scheduler and customize it ? Any pointers?

Huang-Wei commented 4 years ago

With kind, you may need to tweak the kube-scheduler startup arguments to pass-in the policy.{json|yaml}.

The first step is to craft the static scheduler Pod yaml to replace the default one inside container kind-control-plane. e.g.,

apiVersion: v1
kind: Pod
metadata:
  labels:
    component: kube-scheduler
    tier: control-plane
  name: kube-scheduler
  namespace: kube-system
spec:
  containers:
  - command:
    - kube-scheduler
    - --authentication-kubeconfig=/etc/kubernetes/scheduler.conf
    - --authorization-kubeconfig=/etc/kubernetes/scheduler.conf
    - --bind-address=127.0.0.1
    - --config=/etc/kubernetes/sched-config-v1alpha1.yaml
    # - --kubeconfig=/etc/kubernetes/scheduler.conf
    # - --leader-elect=true
......

And then in /etc/kubernetes/sched-config-v1alpha1.yaml, pass-in the extender policy via File or ConfigMap.

Hope this helps.

srini1978 commented 4 years ago

Thanks @Huang-Wei . So the procedure is

1) Create the above file as some x.yaml 2) On the kind cluster that i have, submit the deployment using kubectl apply -f some.yaml 3) Now we have made kind cluster to recognize the scheduler extender we have installed on http://localhost:8888 (i was able to extend your repository and set up filter and prioritize actions on my machine)

Let me know if i got it right ? Also i did not fully understand the yaml file above. do you have an example ?

Huang-Wei commented 4 years ago

Nope. The yaml should replace the scheduler pod yaml inside kind-control-plane container at path /etc/kubernetes/manifests.

Also i did not fully understand the yaml file above. do you have an example ?

The original default scheduler pod yaml could be obtained also at that path. You can check it out.