Kubernetes/Cert
[CKA] taint
lumination
2025. 2. 13. 11:38
조회
kubectl describe nodes | grep -i taint
taint
# kubectl taint nodes <노드명> <키>=<값>:<효과>
# 키값은 자유이나 많이 쓰는 형식이 있음 node-role.kubernetes.io=control-plane:NoSchedule
# 키값은 자유이나 많이 쓰는 형식이 있음 node-role.kubernetes.io=worker:NoSchedule
# 값 생략 가능 node-role.kubernetes.io=NoSchedule
# NoSchedule: toleration 없는 Pod이 이 노드에 스케줄 되지 않음
# PreferNoSchedule: 가능하면 스케줄하지 않지만 강제는 아님
# NoExecute: 기존 Pod도 강제 종료됨 (evict)
kubectl taint nodes controlplane node-role.kubernetes.io=control-plane:NoSchedule
Taint 활용 예시
(1) GPU 노드에서만 실행하도록 제한
kubectl taint nodes gpu-node dedicated=gpu:NoSchedule
→ 일반 Pod은 gpu-node에서 실행되지 않음.
→ tolerations을 추가한 Pod만 실행 가능.
tolerations:
- key: "dedicated"
operator: "Equal"
value: "gpu"
effect: "NoSchedule"