Deploying Prometheus & Grafana on Kubernetes

Image for post
Image for post

Project Description

Integrate Prometheus and Grafana and perform in the following way:

1. Deploy them as pods on top of Kubernetes by creating resources Deployment, Replica Set, Pods or Services

2. And make their data to remain persistent

3. And both of them should be exposed to the outside world

Pre-requisites for the practical :

  1. Docker should be installed in Rhel VM.
  2. A Kubernetes Cluster should be in running state(here I am using Minikube cluster in Windows OS).

Stepwise Implementation:

STEP 1: Create Docker images for Prometheus and Grafana

  1. Create a Prometheus Docker image in Rhel8 VM for deploying Prometheus server as a pod in K8s cluster

2. Build the Docker image with tag and version and push it to the DockerHub repository

3. Create a Grafana Docker image in Rhel8 VM for deploying Grafana server as a pod in K8s cluster

4. Build the Docker image with tag and version and push it to the DockerHub repository

STEP 2: Creating Prometheus Deployment on top of Kubernetes Cluster

Creating pods on top of Kubernetes by creating resources Deployment, Replica Set, Pods or Services and make their data to remain persistent

STEP 3: Creating Grafana on top of Kubernetes Cluster

Creating pods on top of Kubernetes by creating resources Deployment, Replica Set, Pods or Services and make their data to remain persistent

STEP 4: Deploy both Prometheus and Grafana Server on Kubernetes Cluster

STEP 5: Connect the Prometheus with Grafana

  1. Click to Add your first Data Source and then select Prometheus and provide the URL of the Prometheus server and Save it.

2. Create a dashboard with some Prom Queries in different panels to monitor

Now we have successfully deployed Prometheus and Grafana server on top of Kubernetes Cluster with our own custom Docker Images!!!

GitHub Link:

The repo contains all the necessary files for performing this experiment like Dockerfile, Deployment file in yaml for Prometheus and Grafana.

Thank you for staying till the end of this project, Do Star my Repo and claps are appreciated on my blog if you loved it.

Written by

Computer Science Engineer | ML | DevOps | Cloud

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store