Kubernetes的艰难方法-如何设置不可计划的节点 [英] Kubernetes the hard way - How to set node unschedulable
问题描述
我正在从头开始配置Kubernetes集群(原因).它是VM中的本地设置,一切正常,除了master
节点是可调度的.
I am provisioning a Kubernetes cluster from scratch (reasons). Its a local setup inside VM, and everything is fine, except the master
node is created as schedulable.
我尝试通过将必需的参数传递给kubelet二进制文件来为节点分配master
标签和适当的异味(无法解决问题):
I have tried assigning the master
label and appropriate taint to node by passing required arguments to kubelet binary (doesn't solve the problem):
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule
--node-labels=master,node-role.kubernetes.io/master=""
这是kubectl describe <node>
的输出:
Name: myNodeName
Roles: master
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/hostname=myHostName
master=
node-role.kubernetes.io/master=
Annotations: node.alpha.kubernetes.io/ttl=0
volumes.kubernetes.io/controller-managed-attach-detach=true
CreationTimestamp: Tue, 03 Jul 2018 05:56:53 +0000
Taints: node-role.kubernetes.io/master=true:NoSchedule
Unschedulable: false
如何将此节点设置为不可计划"?文档中并没有真正指定此内容(如果我错过了某些内容,可以直接将其定向到文档的适当部分).
How do I set this node as Unschedulable? The documentation doesn't really specify this (feel free to direct to appropriate part of the documentation, in case I missed something).
PS:在创建/注册节点之前,上面已经提到了标签/污点.
PS: The labels/taints mentioned above were present before the node was created/registered.
推荐答案
使用污点,我们可以标记节点,以防止调度程序将其用于带有NoSchedule
参数的某些Pod,并且它们具有特殊的值, Kubernetes Scheduler在计划步骤中使用.默认情况下,无法在带有污点的节点上生成Pod,直到您添加tolerations
为止,这将允许调度程序在toleration
配置中指定的具有污点的节点上创建Pod.因此,根据您的节点描述,您已成功将该节点注册为NoSchedule
,这意味着Pod将不会在该节点上进行调度.
Taints get us a possibility to mark a node in order to prevent scheduler from using it for certain Pods with a NoSchedule
parameter, and they have special values which Kubernetes Scheduler uses on the planning step. Pods by default cannot be spawned on nodes with taints until you will add tolerations
which will allow scheduler to create pods on nodes with taints specified in toleration
configuration; therefore, as per your node description, you have successfully registered this node as NoSchedule
and it means that Pods will not be scheduled on this node.
污点:node-role.kubernetes.io/master=true:NoSchedule
Taints: node-role.kubernetes.io/master=true:NoSchedule
或者,您可以使用kubectl cordon NODE
命令将节点标记为不可调度;因此,它将完全禁用该节点的调度,因此Kubernetes Scheduler只会在规划工作负载的过程中将其忽略,并且会反映在您的节点配置中,例如:
Alternatively, you can use kubectl cordon NODE
command to mark the node as unschedulable; therefore it will disable scheduling for the node at all, so Kubernetes Scheduler will just ignore it in the process of planning workload, and it reflects in your node configuration like:
无法计划:是
这篇关于Kubernetes的艰难方法-如何设置不可计划的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!