简体   繁体   English

kubernetes正在调度Pod来掌握

[英]kubernetes is scheduling pods to master

A few days ago I looked up that some pods are being scheduled to master node. 几天前,我抬起头来计划将某些吊舱计划为主节点。

I want to understand why the cluster works this way by default instead of scheduling to workers nodes. 我想了解为什么集群默认情况下会以这种方式工作,而不是调度到工作程序节点。

You should check the Taint/Toleration concept. 您应该检查污染/容忍概念。 I think this Kub Docs link describes how pods are un-assigned to specific nodes quite effectively. 我认为这个Kub Docs链接描述了如何将Pod非常有效地取消分配给特定节点。 Eg, the master node holds by default a NoSchedule taint and pods with corresponding toleration can schedule on Master Node. 例如,默认情况下,主节点拥有NoSchedule污点,并且具有相应容差的Pod可以在主节点上进行调度。

Unless, pods were created with Node Affinity to schedule on a specific node. 除非,否则将使用“节点亲和性”创建窗格以在特定节点上进行调度。 The same link again refers to Node Affinity as well. 相同的链接也再次指代节点亲和力。 In both cases, pods were customized to hold toleration or affinity or you've customized the master. 在这两种情况下,都对pod进行了自定义以容纳宽容度或亲和力,或者您已经自定义了master。

Use kubectl describe command to check the referenced attributes on node or pod. 使用kubectl describe命令检查节点或Pod上的引用属性。

Like @AYA mentioned, Taint/Toleration, NodeSelector, Affinity are correct ways to prevent schedule pods on node. 就像提到的@AYA一样,Taint / Toleration,NodeSelector,Affinity是防止节点上的计划吊舱的正确方法。

However, in cluster created by kubeadm, master node already have taint to prevent random pods running on the master node. 但是,在kubeadm创建的群集中,主节点已经具有污点,以防止在主节点上运行随机Pod。 The exception is made for pods with corresponding toleration included in the specification. 规范中包含相应容差的吊舱除外。 You did not provide YAML of the pod that has been scheduled on the master. 您未提供已在主服务器上计划的Pod的YAML。 Reason why K8s scheduling pods to MasterNode might be related to kubernetes networking or kubernetes control-plan like flannel, calico, wave, etc. K8将Pod调度到MasterNode的原因可能与kubernetes网络或kubernetes控制计划如绒布,印花布,波浪等有关。

To restore default taint to the master node you have to execute command below: 要将默认污点还原到主节点,您必须执行以下命令:

$ kubectl taint nodes <master-node-name> node-role.kubernetes.io/master="":NoSchedule

Please keep in mind that some pods are designed to run on master node and we should not prevent them from scheduling. 请记住,某些Pod被设计为在master node上运行,我们不应该阻止它们进行调度。 It might affect cluster and may result with poor performance or unstable work. 它可能会影响群集,并可能导致性能不佳或工作不稳定。

On master node should be at least: master node上至少应为:

  • storage-provisioner 存储供应商
  • kube-scheduler 库伯调度器
  • kube-controller-manager kube-controller-manager
  • kube-apiserver kube-apiserver
  • etcd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM