Integrating Grafana with Prometheus and K8S

Ankit Prakash
3 min readOct 14, 2020

--

Grafana:The open-source platform for monitoring and observability. Grafana allows you to query, visualize, alert on and understand your metrics no matter where they are stored. Create, explore, and share dashboards with your team and foster a data driven culture.

Prometheus: a Cloud Native Computing Foundation project, is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true.

Kubernetes (K8s): is an open-source system for automating deployment, scaling, and management of the containerized applications

Task Description

1. Integration Of Prometheus and Grafana on top of Kubernetes.
2. Prometheus Configuration and Grafana Database Storage should be persistent.
3. Prometheus and Grafana Deployments should be exposed to the world.

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.

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.

Dashboard

--

--

Ankit Prakash
Ankit Prakash

No responses yet