Prometheus și Grafana
Introducere
Prometheus este un sistem open-source de monitorizare și alertare conceput pentru Kubernetes. El colectează date din multiple surse (exporteri) folosind modelul pull, adică interoghează periodic fiecare componentă și salvează rezultatele în baza proprie de date temporale.
Grafana este un instrument de vizualizare care se conectează la Prometheus și afișează metricile prin panouri și grafice interactive.
Vom instala împreună aceste instrumente folosind chart-ul Helm kube-prometheus-stack, care
include:
- Prometheus
- Grafana
- Alertmanager
- Kube State Metrics
- Node Exporter
- dashboard-uri preconfigurate pentru cluster.
Instalare
Adăugăm repository-ul și instalăm o versiune compatibilă cu Kubernetes 1.21:
$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
"prometheus-community" has been added to your repositories
$ helm repo update
[...]
Update Complete. ⎈Happy Helming!⎈
$ helm install monitoring prometheus-community/kube-prometheus-stack --version 45.7.1
NAME: monitoring
LAST DEPLOYED: Fri Nov 7 15:24:47 2025
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
kube-prometheus-stack has been installed. Check its status by running:
kubectl --namespace default get pods -l "release=monitoring"
Visit https://github.com/prometheus-operator/kube-prometheus for instructions on how to create & configure Alertmanager and Prometheus instances using the Operator.
Verificăm resursele:
$ kubectl get pods -l "release=monitoring"
NAME READY STATUS RESTARTS AGE
monitoring-kube-prometheus-operator-7558c8c794-gq9zf 1/1 Running 0 44s
monitoring-kube-state-metrics-cd9585d7b-l8ml5 1/1 Running 0 44s
monitoring-prometheus-node-exporter-rbqvl 1/1 Running 0 44s
$ kubectl get svc -l "release=monitoring"
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
monitoring-kube-prometheus-alertmanager ClusterIP 10.96.34.22 <none> 9093/TCP 50s
monitoring-kube-prometheus-operator ClusterIP 10.96.171.56 <none> 443/TCP 50s
monitoring-kube-prometheus-prometheus ClusterIP 10.96.104.98 <none> 9090/TCP 50s
monitoring-kube-state-metrics ClusterIP 10.96.102.108 <none> 8080/TCP 50s
monitoring-prometheus-node-exporter ClusterIP 10.96.59.147 <none> 9100/TCP 50s
După câteva minute, toate podurile ar trebui să fie în stare Running.