首页/云/云与容器速查/kubectl taint 节点污点与容忍
Kubernetes68 条

kubectl taint 节点污点与容忍

污点让节点拒绝/劝退特定 Pod:NoSchedule 不调度新 Pod、PreferNoSchedule 尽量避免、NoExecute 驱逐不满足容忍的存量 Pod;与容忍(Toleration)配对使用。

云与容器速查云更新于 2026-10-12
语法kubectl taint nodes node-1 gpu=true:NoSchedule
删除kubectl taint nodes node-1 gpu=true:NoSchedule-
三种效果NoSchedule / PreferNoSchedule / NoExecute
配合Pod 侧 tolerations 才能落在被污点节点
常见场景GPU 专用节点、专属租户、节点上线前的隔离

使用示例

使用示例
kubectl taint nodes node-gpu-1 gpu=true:NoSchedule
kubectl describe node node-gpu-1 | grep Taints
kubectl taint nodes node-gpu-1 gpu=true:NoSchedule-
看到 Pod Pending 且 describe 提示 taint 不匹配:要么给 Pod 加容忍,要么确认该节点本就该排除。

易错点

  • 加了 NoExecute 忘删:存量 Pod 被驱逐,业务莫名抖动
  • 污点键值写错:容忍匹配不上,Pod 永远 Pending

数据来源与参考

  • Kubernetes Docs:Taints and Tolerations

相关工具

​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌