Net Eng

[CKA] - Node 정보 수집 본문

Cloud/Kubernetes

[CKA] - Node 정보 수집

欲心 2024. 1. 21. 08:47

[선수 작업]

ssh node3 'systemctl disable --now kubelet'
kubectl taint node node2 key1=value1:NoSchedule
mkdir -p /var/CKA2023

 


 

[문제1]

Check to see how many nodes are ready(not including nodes tainted NoSchedule) and write the number to /var/CKA2023/RN0001

 


 

[풀이]

kubectl get nodes | grep -iw Ready

* Ready 상태 Node 확인

 

kubectl describe node master | grep -i NoSchedule
kubectl describe node node1 | grep -i NoSchedule

* Ready 상태의 node 중 Taints가 NoSchedule 설정된 node 확인

 

echo "1" > /var/CKA2023/RN0001

* 카운트 값 넣기

 


 

[문제2]

Count the number of nodes that are ready to run normal workloads

Determine how many nodes in the cluster are `ready` to run normal workloads(ex: workloads that do not have any special tolerations). Output this number to the file `/var/CKA2023/NODE-Count`.

 


 

[풀이]

kubectl get nodes | grep -iw Ready

* Ready 상태 Node 확인

 

kubectl get nodes | grep -iw Ready | wc -l

* wc 명령어로 카운트

 

kubectl get nodes | grep -iw Ready | wc -l > /var/CKA2023/NODE-Count

* 카운트 한 값을 파일에 저장

'Cloud > Kubernetes' 카테고리의 다른 글

[CKA] - Pod Log 추출  (0) 2024.01.21
[CKA] - Deployment & Expose the Service  (0) 2024.01.21
[CKA] - Node 관리  (0) 2024.01.21
[CKA] - Node Labels & nodeSelector  (0) 2024.01.21
[CKA] - Rolling update & Roll Back  (0) 2024.01.19