附录 C. 将标签和污点应用到 Red Hat OpenShift 节点
要让我们的控制 pod 在专用的 Red Hat OpenShift 节点上运行,必须将适当的标签和污点设置为指定节点。
在本例中,我们将选择具有角色 worker 的 Red Hat OpenShift 节点,标签为 aap_node_type=control。
获取您要标记运行的节点的名称
$ oc get nodes-
从列表中选择节点并记录其名称,如
worker1 将
aap_node_type=control标签应用到节点$ oc label node <node-name> aap_node_type=control注意将
<node-name> 替换为您要标记的节点的名称。验证标签的创建,如下所示:
$ oc get nodes --show-labels | grep <node-name>创建标签后,下一步是将
NoSchedule污点添加到已为其创建了标签的 worker 节点。以下命令为节点添加一个
NoSchedule污点:oc adm taint nodes <node-name> dedicated=AutomationController:NoSchedule专用:这是污点的键,它是提供的任意字符串,用于标识污点。Automationcontroller: 这是为污点赋予的任意值。NoSchedule: 这是污点的影响,它没有指定不容许此污点的 pod 将调度到此节点上。通过将此污点应用到节点,我们告知 Kubernetes 调度程序为容许该污点的特定类型工作负载保留此节点。在这种情况下,我们使用 dedicated=AutomationController 容限为工作负载保留节点。
验证污点是否已应用
$ oc get nodes \ -o jsonpath='{range.items[*]}{@.metadata.name}{"\t"}{@.spec.taints[*].key}:{@.spec.taints[*].value}{"\n"}{end}' \ | grep AutomationController