K8s 테인트

1 개요[ | ]

k8s Taint
쿠버네티스 테인트
  • 세 가지 필수 속성: 키(key), 값(value), 효과(effect)로 구성된 코어 오브젝트
  • 테인트는 파드가 노드나 노드 그룹에 스케줄링되는 것을 방지한다.
  • 테인트 및 톨러레이션(toleration)은 함께 작동하며, 파드가 적절하지 못한 노드에 스케줄되는 것을 방지한다.
  • 하나 이상의 테인트가 노드에 적용될 수 있으며, 이것은 노드에 해당 테인트를 극복(tolerate)하지 않은 파드를 허용하지 않도록 표시한다.

2 효과[ | ]

Effect 동작 요약 비유
NoExecute 새 파드 거절 + 톨러레이션 없는 기존 파드 축출 영업 마감
NoSchedule 새 파드 거절 + 기존 파드 유지 주문 마감
PreferNoSchedule 새 파드 회피 (강제 아님) 가능하면 다른 가게 이용 유도

3 실습 1[ | ]

kubectl taint nodes node1 key=value:NoSchedule
$ kubectl describe nodes | egrep ^'Name|Taints'
Name:               master
Taints:             node-role.kubernetes.io/master:NoSchedule
Name:               worker1
Taints:             <none>
Name:               worker2
Taints:             <none>

4 실습 2[ | ]

$ kubectl get no
NAME           STATUS   ROLES           AGE     VERSION
controlplane   Ready    control-plane   7d10h   v1.31.0
node01         Ready    <none>          7d9h    v1.31.0
$ kubectl get no node01 -ojson | jq .spec.taints
null
$ kubectl taint nodes node01 key1=value1:NoSchedule
node/node01 tainted
$ kubectl get no node01 -ojson | jq .spec.taints
[
  {
    "effect": "NoSchedule",
    "key": "key1",
    "value": "value1"
  }
]
$ kubectl taint nodes node01 key1=value1:NoExecute
node/node01 tainted
$ kubectl get no node01 -ojson | jq .spec.taints
[
  {
    "effect": "NoExecute",
    "key": "key1",
    "value": "value1"
  },
  {
    "effect": "NoSchedule",
    "key": "key1",
    "value": "value1"
  }
]
$ kubectl taint nodes node01 key1=value1:NoSchedule-
node/node01 untainted
$ kubectl get no node01 -ojson | jq .spec.taints
[
  {
    "effect": "NoExecute",
    "key": "key1",
    "value": "value1"
  }
]

5 같이 보기[ | ]

6 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}