[kubernetes] Prometheus Monitoring 환경 구축하기
ㅁ 개요
ㅇ 쿠버네티스로 Prometheus Monitoring 환경 구축하기
ㅁ minikube cluster 생성
minikube start --cpus 4 --memory 8192 --vm-driver hyperkit
ㅁ repo 추가
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add stable https://charts.helm.sh/stable
helm repo update
ㅁ char 설치
helm install prometheus prometheus-community/kube-prometheus-stack
ㅁ 설치된 쿠버네티스 환경 확인
ㅇ 쿠버네티스 환경으로 prometheus 설정이 완료되었다.
ㅇ 하지만 grafana가 내부망으로만 설정되어 있어, 외부에서 접속할 수 있도록 설정이 필요하다.
ㅇ service/prometheus-grafana는 생성이 되었지만 External-ip가 없으니 cluster 내부로만 통신이 가능한 상태이다.
ㅁ grafana 로그 확인
kubectl logs prometheus-grafana-5bdf858fc5-z6c49 -c grafana
ㅇ 기본 사용자로 admin이 생성되었고, http listen으로 3000 포트가 세팅되어 있는 것을 확인하였다
ㅁ Port Forward 설정
kubectl port-forward deployments/prometheus-grafana 3000
ㅁ Grafana 접속
ㅇ 어드민 비번은 "prom-operator"이다.
ㅁ 쿠버네티스 대시보드 목록
ㅁ Prometheus UI 연결
kubectl describe pod prometheus-prometheus-kube-prometheus-prometheus-0
** 생략 **
Containers:
prometheus:
Container ID: docker://ad2f4c673664fa6f9cb09cd27a288840ed7e677adefd78cf9719b17ef447d76a
Image: quay.io/prometheus/prometheus:v2.36.1
Image ID: docker-pullable://quay.io/prometheus/prometheus@sha256:f4c5fa1018a5c15f81250b8122f36f90146d5c2b323f9ec1f41d1b36dc0e7cb9
Port: 9090/TCP
Host Port: 0/TCP
** 생략 **
ㅇ 컨테이너의 포트는 9090 이다.
kubectl port-forward prometheus-prometheus-kube-prometheus-prometheus-0 9090
ㅇ port forward 연결을 한다.
ㅇ http://localhost:9090으로 접속을 하였다.
ㅇ Alert 탭을 선택한 화면이다.
ㅇ Status > Runtime & Build Information 에서 현재 정보를 확인 할 수 있다.
ㅁ 함께 보면 좋은 사이트
ㅇ https://github.com/helm/charts/tree/master/stable/prometheus-operator
GitHub - helm/charts: ⚠️(OBSOLETE) Curated applications for Kubernetes
⚠️(OBSOLETE) Curated applications for Kubernetes. Contribute to helm/charts development by creating an account on GitHub.
github.com
ㅇ https://youtu.be/QoDqxm7ybLc