[MLOps] k8s 모니터링 알아가기

dddwsd·2024년 7월 4일

k8s 환경에서 모니터링에 관련된 오픈소스들은 Prometheus / Grafana / Loki 등이 있다.

Prometheus / Loki

Prometheus

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

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 참조

Loki helm chart 종류

  1. loki - 단일 노드 설치 / 작거나 중간 규모의 환경 단일 인스턴스로 충분한 경우
  2. loki-stack - Loki, Promtail, Grafana를 통합하여 한번에 제공한다. / 작거나 중간 규모의 환경에서 한번에 설치를 필요로 하는 경우
  3. loki-distributed - loki의 분산 설치 지원하여 쿼리 및 인덱스를 여러 인스턴스로 확장하고, 복제된 데이터를 관리할 수 있게 해준다 / 대규모 환경에 더 상세한 설정을 해야하는 경우

Prometheus / Loki 차이점

Prometheus는 서비스의 성능 지표와 같은 메트릭 데이터를 수집하고 저장 분석하며, 이를 통해 시스템 상태를 모니터링한다.
반면에 Loki는 로그 데이터를 중심으로 설계되어 대량의 로그 데이터를 효율적으로 수집, 저장 분석할 수 있다.

Grafana

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 참조

profile
Github - https://github.com/dddwsd

0개의 댓글