본문 바로가기

CKA &. CKAD/Scheduling

Practice Test - Taints and Tolerations

ㅁ 기본 설명

 

Taints - Node (Taints 는 Node에 설정하여 Tolerant 설정이 되어 있지 않는 Pod의 스케줄을 막는다.)

kubectl tain nodes node-name key=value:taint-effect 

아래는 설정 예제

kubectl taint nodes node1 app=blue:NoSchedule

 

NoSchedule이 필요한 이유는 아래와 같이 Master Node에 다른 서비스 Pod들이 스케줄 되는 것을 막는 것이 가장 적절한 예로 보임

 

[Practice Test]

 

ㅁ How many Nodes exist on the system?

kubectl get nodes

ㅁ Do any taints exist on node01?

kubectl describe node node01 | grep -i taint

ㅁ Create a taint on node01 with key of 'spray', value of 'mortein' and effect of 'NoSchedule'

kubectl taint node node01 spray=mortein:NoSchedule

ㅁ Create a new pod with the NGINX image, and Pod name as 'mosquito'

kubectl run mosquito --image=nginx --restart=Never

ㅁ Create another pod named 'bee' with the NGINX image, which has a toleration set to the taint Mortein

kubectl run bee --image=nginx --dry-run=client -o yaml > bee.yaml
apiVersion: v1
kind: Pod
metadata:
  name: bee
spec:
  containers:
  - image: nginx
    name: bee
  tolerations:
  - key: "spray"
    operator: "Equal"
    value: "mortein"
    effect: "NoSchedule"
kubectl explain pod --recursive | grep -A5 tolerations

tolerations     <[]object>
  effect <string>
  key    <string>
  operator   <string>
  tolerationSeconds <string>
  value     <string>

ㅁ Do you see any taints on master/controlplane node?

kubectl get node

kubectl describe node controlplane | grep Taints

ㅁ Remove the tain on master/controlplane, which currently has the taint effect of NoSchedule

kubectl taint node controlplane node-role.kubernetes.io/master:NoSchedule-

 

'CKA &. CKAD > Scheduling' 카테고리의 다른 글

Resource Limits  (0) 2021.03.26
Practice Test - Node Selectors/Affinity  (0) 2021.03.26
Practice Test - Labels and Selectors  (0) 2021.03.25
Labels and Selectors  (0) 2021.03.25
Manual Scheduling  (0) 2021.03.25