k8s在节点上加污点
kubectl taint nodes node-1077b-6 dedicated=example:NoSchedule
命令 kubectl taint nodes node-1077b-6 dedicated=example:NoSchedule 的作用是给 Kubernetes 集群中的节点 node-1077b-6 添加一个污点(taint)。这个污点的键为 dedicated,值为 example,效果为 NoSchedule。
具体来说,这个污点的含义是:
键(key): dedicated
值(value): example
效果(effect): NoSchedule
这意味着,任何没有相应容忍(toleration)的 Pod 将不会被调度到这个节点上。只有那些配置了相应容忍的 Pod 才能在这个节点上运行。
使用场景
这种操作通常用于将节点标记为专用节点,确保只有特定的工作负载可以在这些节点上运行,从而实现资源的隔离和管理。
示例
如果你想要让某个 Pod 能够在这个节点上运行,你需要在 Pod 的定义中添加相应的容忍,例如:
tolerations:
- key: "dedicated"
operator: "Equal"
value: "example"
effect: "NoSchedule"
这样,Pod 就可以被调度到 node-1077b-6 节点上。