쿠버네티스 클러스터 환경을 이용할 때 노드 또는 파드에서 사용하고 있는 컴퓨터 자원을 관리적 차원에서 확인하고 싶을 때가 있을 것이다.
서버(노드) 단위로의 컴퓨터 자원을 사용하고 있는 총량은 리눅스 등의 명령어로 확인할 수 있는데, 쿠버네티스의 클러스터 내부 세부적인 환경의 컴퓨터 자원 사용량은 별도의 플러그인을 설치하여 확인할 수 있다.
플러그인에 대한 설명은 아래 쿠버네티스 공식 Docs를 통하여 알아볼 수 있다.
https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/
Resource metrics pipeline
For Kubernetes, the Metrics API offers a basic set of metrics to support automatic scaling and similar use cases. This API makes information available about resource usage for node and pod, including metrics for CPU and memory. If you deploy the Metrics AP
kubernetes.io
여기서 Metric Server라는 API를 이용하여 클러스터 내 각 노드와 파드의 사용량을 추적할 수 있는 것을 볼 수 있다.
그러기 위해서는 다음의 사이트를 참조하여 Metric Server라는 API를 설치할 필요가 있다.
위의 링크 중에서 metrics-server repository에서 쿠버네티스 클러스터 내 설치 내용이 기재되어 있다.
https://github.com/kubernetes-sigs/metrics-server
GitHub - kubernetes-sigs/metrics-server: Scalable and efficient source of container resource metrics for Kubernetes built-in aut
Scalable and efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines. - GitHub - kubernetes-sigs/metrics-server: Scalable and efficient source of container reso...
github.com
1. Metric Server 설치
Metric Server는 github repository 내 yaml을 이용하여 설치하거나, 공식 Helm Chart를 통하여 설치할 수 있다.
# Bash
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
2. Command
설치가 완료되었다면 아래 명령어를 통하여 각 노드와 파드의 컴퓨터 자원 사용량을 확인할 수 있다.
# Bash
# Node
kubectl top node
# Pod
kubectl top pod
'Devops > Kubernetes' 카테고리의 다른 글
[Kubernetes] Secrets 암호화 (2) | 2023.09.26 |
---|---|
[Kubernetes] Ubuntu 환경에서 K9S 설치 (0) | 2023.09.07 |
[Kubernetes] bitnami/kafka (Helm Chart) SASL Authentication 에러 (2) | 2023.08.24 |
[Kubernetes] 쿠버네티스 내 헬름 차트(Helm Chart)로 Apache Kafka 설치(bitnami) (2) | 2023.08.22 |
[Kubernetes] 파드 간 통신 방법과 FQDN/DNS 요청 시 발생한 에러 처리 (0) | 2023.08.21 |