Kubernetes Monitoring With Prometheus Grafana
Kubernetes Monitoring With Prometheus Grafana
What is Prometheus ?
Prometheus is an open-source monitoring tool that collects metrics data,
and provide tools to visualize the collected data.
Scraped metrics are then stored in a time series database which can be
queried using Prometheus’ build-in query language PromQL
Disk Space
Service Uptime
Number of exceptions
Latency
Pending Requests
System Logs
Traces
1. Prometheus Server
Main component that does most of the heavy lifting.
2. Exporters
These are small programs that collect metrics from your applications,
systems, or databases.
They convert this data into a format that Prometheus can understand.
3. Data Storage
You can query this data using PromQL (Prometheus Query Language),
which helps in creating visualizations and setting up alerts.
You can use PromQL to create custom graphs, set up alerts, and analyze
your system’s performance over time.
5. Alertmanager
When certain conditions are met (like high CPU usage), Prometheus can
trigger alerts.
6. Pushgateway
Normally, Prometheus pulls data from applications. But sometimes, apps
might not be able to expose metrics at the right time (like short-lived batch
jobs).
7. Service Discovery
Prometheus can automatically discover targets to monitor, like containers or
microservices, without needing manual configuration.
8. Visualization
You can visualize metrics using Grafana, which integrates with Prometheus
and creates graphs and dashboards.
Zabix
nagios
Why Pull?
Some of the benefits of using a pull based system:
Push based systems could potentially overload metrics server if too many
incoming connections get flooded at same time
Practical Hand-on
Installing Prometheus
1. First we need to install Helm
choco install kubernetes-helm
charts >
Install helm
helm install prometheus prometheus-community/prometheus
3. After that we need to check the IP Address of minikube Cluster and check
the port of expose service Prometheus.
Installing Grafana
1. First we need to install Helm (Skip this if followed before)
choco install kubernetes-helm
Install helm
helm install grafana grafana/grafana
3. After that we need to check the IP Address of minikube Cluster and check
the port of expose service Grafana.