k8s 환경에서 모니터링에 관련된 오픈소스들은 Prometheus / Grafana / Loki 등이 있다.
Prometheus는 시계열 데이터를 기반으로 하는 모니터링 도구이다.
동적인 컨테이너 환경에서 동작하며, 설정된 대상으로부터 메트릭을 수집하여 저장하고, 활용할 수 있다.
설치방법
$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
$ helm repo update
$ helm install prometheus prometheus-community/kube-prometheus-stack -f values.yaml
values.yaml 참조
Loki는 Prometheus에서 영감을 받아 설계된 가로 스케일 가능한 로그 집계 시스템으로 Promtail을 통해 log entry를 수집한 후 loki로 전달한다. 주로 k8s와 같은 클라우드 네이티브 아키텍처에서 사용한다.
설치방법
$ helm repo add grafana https://grafana.github.io/helm-charts
$ helm repo update
$ helm install loki grafana/loki -f values.yaml
values.yaml 참조
Prometheus는 서비스의 성능 지표와 같은 메트릭 데이터를 수집하고 저장 분석하며, 이를 통해 시스템 상태를 모니터링한다.
반면에 Loki는 로그 데이터를 중심으로 설계되어 대량의 로그 데이터를 효율적으로 수집, 저장 분석할 수 있다.
Grafana는 다양한 데이터 소스테서 메트릭을 시각화하고 대시보드를 생성하는 도구이다. 주로 Prometheus나 Loki에서 나오는 데이터를 시각적으로 표현하는데 사용한다.
설치 방법
$ helm repo add grafana https://grafana.github.io/helm-charts
$ helm repo update
$ helm install grafana grafana/grafana -f values.yaml
values.yaml 참조