1

Following this K8s page here on how to use multiple schedulers,and this, all I could see is that the schedulerName is taking place under the pod's spec , though I don't understand if this is explained particularly to single pods (as Pod is the smallest k8s deployable object), or even when a pod is attached to deployment or other deployable resources. In my case, I have a custom scheduler, & I want it to handle scheduling a Daemonset object. I have tried two options:

a. Put the spec.schedulerName: custom-scheduler under the daemonset pod's specs.

b. Put the spec.schedulerName: custom-scheduler under the daemonset specs.

And the results are:

a. The pods of the daemonset were scheduled by the custom-scheduler as can be seen by the pods events.

b. The pods of the daemonset were scheduled by the default scheduler of kube-system.

My question is:

Can the user determine the scheduler for deployable k8s objects other than Pods, for example daemonset/ deployment/replicas? if not, please explain why & how this works internally. Your insights are very appreciated.

shermakh
  • 117
  • 1
  • 7

1 Answers1

2
  • when i check documentation for daemonset.spec i do not see a schedulerName at all as following :
kubectl explain daemonset.spec
KIND:     DaemonSet
VERSION:  apps/v1

RESOURCE: spec <Object>

DESCRIPTION:
     The desired behavior of this daemon set. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status

     DaemonSetSpec is the specification of a daemon set.

FIELDS:
   minReadySeconds      <integer>
     The minimum number of seconds for which a newly created DaemonSet pod
     should be ready without any of its container crashing, for it to be
     considered available. Defaults to 0 (pod will be considered available as
     soon as it is ready).

   revisionHistoryLimit <integer>
     The number of old history to retain to allow rollback. This is a pointer to
     distinguish between explicit zero and not specified. Defaults to 10.

   selector     <Object> -required-
     A label query over pods that are managed by the daemon set. Must match in
     order to be controlled. It must match the pod template's labels. More info:
     https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors

   template     <Object> -required-
     An object that describes the pod that will be created. The DaemonSet will
     create exactly one copy of this pod on every node that matches the
     template's node selector (or on every node if no node selector is
     specified). More info:
     https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template

   updateStrategy       <Object>
     An update strategy to replace existing DaemonSet pods with new pods.
  • it is available only for pod.spec ( my kubernetes version is 19.4 )
confused genius
  • 2,876
  • 2
  • 16
  • 29
  • 1
    thank you for your response. So from these resources I mentioned above, we can see that spec.schedulerName is set in pod's template. I know this is not telling explicitly that it doesn't work under other deployable objects, but it doesn't tell that it works either. OTOH if we create a deployment/daemonset or any other deployable object & set the schedulerName=custom-sched under their specs, then apply those objects, we can see in the pods created for those objects, that the scheduler which took charge is the default one & not the custom one. – shermakh Jan 20 '22 at 08:43
  • 1
    Another stronger proof I see is that, if we try to describe that deployment/daemonset (kubectl describe deployment ) we notice that our set of the schedulerName under that object spec was ignored & instead the pod spec now has that field with the default scheduler name. Therefore, I believe this to be sufficient proof. – shermakh Jan 20 '22 at 08:43
  • 1
    Yes , That concludes it . Ideally kubectl should throw an error saying unsupported/unknown key when we mention ```schedulerName``` in deployment or daemonset spec. – confused genius Jan 20 '22 at 09:44