DevOps: Monitoring Tools (Prometheus and Grafana)

Rahul Yadav
3 min readJun 20, 2020

DevOps includes software development and IT operations. Its main aim is to automate the systems deployment life cycle and provide continuous delivery without the downtime and with high software quality.

Continuous Monitoring is the process of monitoring each and every phase of DevOps and IT operations lifecycle. This process ensures the health, performance, and reliability of your application.

Prometheus and Grafana are two open-source tools used for monitoring the applications. Prometheus stored the metrics at backend and Grafana visualize those metrics.

“Here is the demonstration of Integration of Prometheus and Grafana”

Deploying Prometheus and Grafana as a pod on Kubernetes by creating resources Deployment, Replicaset, Pods, and service.

It is open-source and community-driven. It's all components are available under the Apache 2 License on GitHub.

To create a dockerfile:

Build this image:

docker build -t prome:v1 .

Now Creating Persistent volume, Persistent volume claim, and Prometheus deployment.

To create deployment using this file and expose the deployment to the outside world so that we can access the Prometheus UI from any system into the network:

kubectl create -f prome.ymlkubectl expose deployment prometheus-deployment --port=9090 --type=NodePort
Prometheus Deployment
Prometheus running

Grafana is multi-platform open-source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources. It is expandable through a plug-in system. End users can create complex monitoring dashboards using interactive query builders.

To create grafana image:

FROM centos
RUN yum install wget -y
RUN wget https://dl.grafana.com/oss/release/grafana-7.0.3-1.x86_64.rpm
RUN yum install grafana-7.0.3-1.x86_64.rpm -y
WORKDIR /usr/share/grafana
CMD /usr/sbin/grafana-server start && /usr/sbin/grafana-server enable && /bin/bash

Build this image:

docker build -t graf:v1 .

Now creating persistent volume, persistent volume claim, and deployment for grafana.

Now creating PV, PVC, and deployment for grafana and also exposing it to port no 3000.

kubectl create -f grafana_deployment.ymlkubectl expose deployment grafana-deployment --port=3000 --type=NodePort
All the deployments, services and pods
Grafana analysis

Conclusion :

By this, you can successfully integrate Prometheus and Grafana and deploy them on Kubernetes.

--

--