STUDY/Data Engineering
[kodekloud] 02 Scheduling : Taints and Tolerations 풀이
wonpick
2023. 1. 23. 00:43
Q1. How many nodes exist on the system?
alias k=kubectl; k get nodes
Q2.Do any taints exist on node01 node?
kubectl describe node node01 | grep -i taints
# i 옵션 : 특정 문자열을 대소문자 구분 없이 검색
Q3. Create a taint on node01 with key of spray, value of mortein and effect of NoSchedule
k taint node node01 spray=mortein:NoSchedule
#kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N [options]
이전에는 none이 었던 taint가 변경된것을 확인할 수 있다.
Q4. Create a new pod with the nginx image and pod name as mosquito.
k run mosquito --image=nginx
Q5. What is the state of the POD?
Q6. Why do you think the pod is in a pending state?
k describe pods
Q7. Create another pod named bee with the nginx image, which has a toleration set to the taint mortein.
k run bee --image=nginx --dry-run=client -o yaml > bee.yaml #파일 생성
k create -f bee.yaml
--
tolerations:
- key: spray
value: mortein
effect: NoSchedule
operator: Equal
Q8. Notice the bee pod was scheduled on node node01 despite the taint.
Q9. Do you see any taints on controlplane node?
k describe node controlplane
Q10. Remove the taint on controlplane, which currently has the taint effect of NoSchedule.
kubectl taint nodes controlplane node-role.kubernetes.io/control-plane:NoSchedule-
Q11. What is the state of the pod mosquito on now?
running
Q12. Which node is the POD mosquito on now?
controlplane