What is Prometheus?
Prometheus is an open-source system monitoring and alerting toolkit originally built at SoundCloud. Since its inception in 2012, many companies and organizations have adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project and maintained independently of any company.
Prometheus’s main features are:
- a multi-dimensional data model with time series data identified by metric name and key/value pairs
- PromQL, a flexible query language to leverage this dimensionality
- no reliance on distributed storage; single server nodes are autonomous
- time-series collection happens via a pull model over HTTP
This tool combines well with yet another amazing tool “Grafana”.
What is Grafana?
Grafana is open-source visualization and analytics software. It allows you to query, visualize, alert on, and explore your metrics no matter where they are stored. In plain English, it provides you with tools to turn your time-series database (TSDB) data into beautiful graphs and visualizations.
Grafana connects with every possible data source, commonly referred to as databases such as Graphite, Prometheus, Influx DB, ElasticSearch, MySQL, PostgreSQL, etc. Grafana being an open-source solution also enables us to write plugins from scratch for integration with several different data sources.
What Is Kubernetes?
Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of the containerized applications. It groups containers that make up an application into logical units for easy management and discovery. Kubernetes builds upon 15 years of running production workloads at Google, combined with best-of-breed ideas and practices from the community.
About the Task:
1. Integration Of Prometheus & Grafana on top of ⎈Kubernetes⎈.
2. Prometheus Configuration and Grafana Database Storage should be persistent.
3. Prometheus & Grafana Deployments should be exposed to the world.
Steps to be followed:
Create a ConfigMap
ConfigMap — A ConfigMap is an API object used to store non-confidential data in key-value pairs. Pods can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a volume.
using docker image of
Create a Prometheus Deployment
Deployments — A Deployment provides declarative updates for Pods and ReplicaSet.
Once we have deployed and exposed Prometheus, anyone from outside can access it , we can see the graph progress.
We provided targets for the Prometheus in the prom_config-map(ConfigMap) file which will be reflected in the Service Discovery in Prometheus.
Visualize the metrics:
Create a PVC
PVC — A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator or dynamically provisioned using Storage class. It is a resource in the cluster just like a node is a cluster resource.
Create a Grafana Deployment
We have to expose the Grafana Deployment after which anyone can access it.