为什么 spec.schedulerName 在 daemonset 下不起作用?

Why spec.schedulerName does not work under daemonset?

在这个 K8s 页面 here on how to use multiple schedulers,and this 之后,我所能看到的是 schedulerName 是在 pod 的规范 下进行的,尽管我不知道了解这是否特别针对单个 pods 进行了解释(因为 Pod 是最小的 k8s 可部署对象),或者甚至当 pod 附加到部署或其他可部署资源时。在我的例子中,我有一个自定义调度程序,我希望它能够处理 Daemonset 对象的调度。我尝试了两种选择:

一个。将 spec.schedulerName: custom-scheduler 放在 daemonset pod 的规格下。

b。将 spec.schedulerName: custom-scheduler 放在 daemonset 规范下。

结果是:

一个。 daemonset 的 pods 由自定义调度程序调度,如 pods 事件所示。

b。 daemonset 的 pods 由 kube-system 的默认调度程序调度。

我的问题是:

用户能否确定 Pods 以外的可部署 k8s 对象的调度程序,例如 daemonset/ deployment/replicas?如果不是,请解释为什么以及它在内部是如何工作的。非常感谢您的见解。

  • 当我查看 daemonset.spec 的文档时,我根本没有看到 schedulerName,如下所示:
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.
  • 它仅适用于 pod.spec(我的 kubernetes 版本是 19.4)