Launch Prometheus and Grafana on Kubernetes

Aditya Raj
3 min readJul 11, 2020

--

Task Description:-

  1. Deploy them as pods on top of Kubernetes by creating resources Deployment, ReplicaSet, Pods or Services
  2. And make their data to be remain persistent
  3. And both of them should be exposed to outside world

Step 1:

Firstly we need to create Docker image for Prometheus and Grafanan

Dockerfile for Prometheus:

Dockerfile for Grafana:

Now we need to build image from these Dockerfile and then push them on Docker hub.

Step 2:

Now we need to launch two pods with these image but before that we need to create PVC for both the pods, one for Prometheus and the other for Grafana.

File to create Prometheus PVC:

File to craete Grafana PVC:

After running these two file two PVC will be craeted one for Prometheus and the other for Grafana

Step 3:

In this step we need to launch two pods from Promethes and Grafana image and also we will attach the PVC created.

Deployment file for Prometheus pod:

Deployment file for Grafana pod:

After running these two file two Pods will be craeted one with Prometheus image and the other with Grafana image.

Step 4:

In this step we will expose the pods to the outside world. Againg to expose the pods I have craeted to expose file that will expose the pods to the outside world.

Expose file for Prometheus pod:

Expose file for Grafana pod:

After running these two file both the Pods will be expose to the outside world.

Thank You!!

--

--

Aditya Raj

I'm passionate learner diving into the concepts of computing 💻