Kubernetes

Taints & Tolerations

빠빠담 2021. 12. 13. 23:11
반응형

 

https://kubernetes.io/ko/docs/concepts/scheduling-eviction/taint-and-toleration/

 

테인트(Taints)와 톨러레이션(Tolerations)

노드 어피니티는 노드 셋을 (기본 설정 또는 어려운 요구 사항으로) 끌어들이는 파드의 속성이다. 테인트 는 그 반대로, 노드가 파드 셋을 제외할 수 있다. 톨러레이션 은 파드에 적용되며, 파드

kubernetes.io

 

 

Taints

 

추가

kubectl taint nodes node1 key1=value1:NoSchedule

제거

kubectl taint nodes node1 key1=value1:NoSchedule-

 

 

  • NoSchedule : toleration이 없으면 포드가 스케쥴 되서 실행되지 않습니다. 기존에 실행되던 포드에는 적용되지 않습니다.
  • PreferNoSchedule: toleration이 없으면 포드를 스케쥴링 하지 않으려고 하긴 하지만 필수는 아닙니다. 클러스터내의 자원이  부족하거나 하면 taint가 걸려 있는 노드에서 포드가 스케쥴링 될 수 있습니다. 
  • NoExecute : 새로운 포드도 toleration이 없으면 실행되지 않게 하고, 기존에 있던 포드역시 taint에 맞는 toleration설정이 없으면 종료시킵니다. 

 

 

Tolerations

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: sample-app
  name: sample-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: sample-app
  strategy: {}
  template:
    metadata:
      labels:
        app: sample-app
    spec:
      containers:
      - image: sample-app
        name: sample-app
      tolerations:
      - key: service
        value: abc
        operator: Equal
        effect: NoSchedule
      - key: service
        operator: Exists
        effect: NoSchedule

지정하지 않으면 operator 의 기본값은 Equal 이다.

톨러레이션은 키가 동일하고 이펙트가 동일한 경우, 테인트와 "일치"한다. 그리고 다음의 경우에도 마찬가지다.

  • operator  Exists 인 경우(이 경우 value 를 지정하지 않아야 함), 또는
  • operator  Equal 이고 value  value 로 같다.

 

반응형

'Kubernetes' 카테고리의 다른 글

Helm - Basic  (0) 2021.12.19
Ingress - Nginx  (0) 2021.12.18
Fargate  (0) 2021.12.11
K9S  (0) 2021.12.11
Kubernetes - EKS Console setup  (0) 2021.12.11