1. Prometheus로 Kafka Metrics 수집
1-1. exporter 설정된 카프카 클러스터 배포(첨부파일의 kafka-2.yaml)
- 기존에 배포된 kafka-1.yaml을 kafka-2.yaml 설정으로 업데이트 (처음부터 kafka-2.yaml로 배포했다면 재배포 할 필요 X)
- Deployment로 kafka-exporter가 생성되고, 생성되었던 카프카클러스터가 Update가 됨
- 기존 카프카 클러스터가 update되기때문에 RollingUpdate하는 과정을 진행 (default옵션)
kubectl apply -f kafka-2.yaml -n kafka
1-2. monitoring라는 namespace 생성
kubectl create namespace monitoring
1-3. 프로메테우스 설치 : --server-side 옵션 설정
- 첨부파일의 프로메테우스 yaml을 monitoring namespace로 배포
kubectl apply -f prometheus-operator-deployment.yaml -n monitoring --server-side
kubectl apply -f prometheus.yaml -n monitoring
kubectl apply -f prometheus-rules.yaml -n monitoring
kubectl apply -f strimzi-pod-monitor.yaml -n monitoring
2. Grafana(그라파나) 설치
2-1. 첨부파일의 grafana.yaml 배포
kubectl apply -f grafana.yaml -n monitoring
2-2. 로드밸런서 설정
kubectl patch svc -n monitoring grafana -p '{"spec":{"type":"LoadBalancer"}}'
kubectl annotate service grafana -n monitoring "external-dns.alpha.kubernetes.io/hostname=grafana.$MyDomain"
2-3. 배포 확인
echo -e "Grafana URL = http://grafana.$MyDomain:3000"
2-4. 그라파나 주소 확인
- grafana service는 monitoring namespace내부에 배포했기 때문에 -n monitoring 을 붙여줘야 함 (namespace명)
kubectl get svc -n monitoring
2-5. 그라파나 접속
- 34.22.70.115:3000 (EXTERANL - IP : PORT)
- ID : admin / Password : admin 입력
2-5. 그라파나 데이터 소스 설정
URL칸
prometheus-prometheus-0.prometheus-operated.monitoring.svc.cluster.local:9090 을 입력하면
Kafka의 metrics 데이터 소스가 저장됨
2-6. 첨부된 json 파일들을 하나씩 import
- 데이터 소스는 Prometheus
2-7. 대시보드 확인
- 카프카 대시보드, 카프카 exporter, 주키퍼 대시보드 순
'Kubernetes' 카테고리의 다른 글
[Kubernetes-Kafka] 1. strimzi-Kafka 및 Kafka-UI 설치 (0) | 2025.02.06 |
---|---|
[Kubernetes] 쿠버네티스 관리 도구 K9s (0) | 2025.01.30 |