본문 바로가기
cloud/k8s(문제풀이)

[cka]kodekloud-Taints & Tolerations

by mozi2 2022. 6. 8.
반응형

1.How many nodes exist on the system? Including the controlplane node.

# k get nodes 

A) 2 

 

2. Do any taints exist on node01 node?

# k describe node node01

A) NO

 

3. Create a taint on node01 with key of spray, value of mortein and effect of NoSchedule

  • Key = spray

  • Value = mortein

  • Effect = NoSchedule

# k taint node node01 spray=mortein:NoSchedule

# k describe nodes node01

: node01 노드에  key, vaule, effect 를 추가할 것 

 

* taint 를 수정하려면 뒤에 " --overwrite "옵션만 추가하면됨 

4. Create a new pod with the nginx image and pod name as mosquito.

  • Image name: nginx

# k run mosquito --image=nginx

# k get pods

5. What is the state of the POD?

# k get pods

 : 위의 그림참조

 

6. Why do you think the pod is in a pending state?

# k describe pods mosquito

A) POD Mosquito cannot tolerate taint Mortein

 

7. Create another pod named bee with the nginx image, which has a toleration set to the taint mortein.

  • Image name: nginx

  • Key: spray

  • Value: mortein

  • Effect: NoSchedule

  • Status: Running

# k run bee --image=nginx --dry-run=client -o yaml > bee.yaml

# vi bee.yaml

  tolerations:
  - key: "example-key"
    operator: "Exists"
    effect: "NoSchedule"

 :  상단의 내용 추가 

 

 # k apply -f bee.yaml

8. Notice the bee pod was scheduled on node node01 despite the taint.

# k get pods bee -o wide

: Node header 의 node01 이 할당 된 것을 알 수 있음 .

 

9. Do you see any taints on controlplane node?

# k describe node controlplane

A) Yes - NoSchedule

 

10.Remove the taint on controlplane, which currently has the taint effect of NoSchedule.

 

  * taint 제거하는 방법

1) # k describe node controlplane 

2) 삭제할 taint 를 복사한다. 

3) # k taint node controlplane node-role.kubernetes.io/master:NoSchedule-

   복사한 taint를  node 명 뒤에 작성한 후 "-" 마이너스를 붙인다.

untaints 된 모습을 볼 수 있다. 

 

11.What is the state of the pod mosquito now?

# k get nodes

A) Running 

 

12.Which node is the POD mosquito on now?

# k describe pod mosquito

A) controlplane

728x90
반응형

'cloud > k8s(문제풀이)' 카테고리의 다른 글

[cka]kodekloud-Resources Limit  (0) 2022.06.09
[cka]kodekloud-Affinity  (0) 2022.06.09
[cka]kodekloud - Labels & selectors  (0) 2022.06.08
[cka] kodekloud-scheduling  (0) 2022.06.08
[cka] kodekloud - IMPERATIVE COMMANDS  (0) 2022.06.07