본문 바로가기
IT 잡지식/DevOps

[CKA] KodeKloud - Monitor Cluster Components

by 쯀리♥️ 2024. 6. 23.

 

 

안녕하세요, 쯀리입니다.

오늘은 Monitor Cluster Components에 관해 알아보겠습니다. 

https://github.com/kodekloudhub/kubernetes-metrics-server

 

GitHub - kodekloudhub/kubernetes-metrics-server: Development environment deployment of metrics-server

Development environment deployment of metrics-server - kodekloudhub/kubernetes-metrics-server

github.com

 


Quiz.

1. We have deployed a few PODs running workloads. Inspect them.
Wait for the pods to be ready before proceeding to the next question.

controlplane ~ ➜  k get pods
NAME       READY   STATUS    RESTARTS   AGE
elephant   1/1     Running   0          31s
lion       1/1     Running   0          31s
rabbit     1/1     Running   0          31s

 

2. Let us deploy metrics-server to monitor the PODs and Nodes. Pull the git repository for the deployment files.
Run: git clone https://github.com/kodekloudhub/kubernetes-metrics-server.git

controlplane ~ ➜  ls
kubernetes-metrics-server  sample.yaml

kubernetes-metrics-server 디렉토리가 생성되었네요

3. Deploy the metrics-server by creating all the components downloaded.
Run the kubectl create -f . command from within the downloaded repository.

controlplane kubernetes-metrics-server on  master ➜  kubectl create -f .
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created
rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created
apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created
serviceaccount/metrics-server created
deployment.apps/metrics-server created
service/metrics-server created
clusterrole.rbac.authorization.k8s.io/system:metrics-server created
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created

 

4. It takes a few minutes for the metrics server to start gathering data.
Run the kubectl top node command and wait for a valid output.

controlplane kubernetes-metrics-server on  master ➜  k top node
NAME           CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
controlplane   240m         0%     924Mi           0%        
node01         36m          0%     280Mi           0%

 

5. Identify the node that consumes the most CPU(cores).
가장 많은 CPU를 차지하는것은 아무래도 controlplane이네요.

6. Identify the node that consumes the most Memory(bytes).
가장 많은 Memory를 차지하는것도  controlplane입니다.

7. Identify the POD that consumes the most Memory(bytes) in default namespace
가장 많은 메모리를 차지하는 pod는 rabbit입니다.

controlplane ~ ✖ k top pods
NAME       CPU(cores)   MEMORY(bytes)   
elephant   13m          32Mi            
lion       1m           18Mi            
rabbit     93m          252Mi

 

8. Identify the POD that consumes the least CPU(cores) in default namespace.

lion입니다. 

 


K8s를 공부하면서 각 pod들이나 node들의 메모리/CPU사용량을 확인하며 설계하는것은 정말 중요합니다. 
이렇게 서비스를 확인하면서 메모리 리소스들을 관리해주는 역할은 DevOps가 가져야할 덕목이라는 생각이 듭니다.

다음시간에는 Managing Application을 가져와볼게요!

안녕~

 


참조

 Udemy Labs - Certified Kubernetes Administrator with Practice Tests