Integrating Prometheus and Grafana using Kubernetes

Vanshita Mittal
4 min readJul 16, 2020

--

Finally , I completed Task 5 of DevOps AL given by Vimal Daga Sir.

Explanations:

Prometheus is a leading open-source metric instrumentation, collection, and storage toolkit built at SoundCloud beginning in 2012. Since then, it’s graduated from the Cloud Native Computing Foundation and become the de facto standard for Kubernetes monitoring.

Grafana is an open-source platform for data visualization, monitoring, and analysis. Used by thousands of companies to monitor everything from infrastructure, applications, and power plants to beehives

Task :

Integrate Prometheus and Grafana and perform in following way:

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

STEPS :

  1. We need to be installed minikube and configured kubectl in base OS.Then start minikube.

2. To setup Prometheus and Grafana I used two images available at Docker Hub. These are official Prometheus and Grafana images available. One can also create their own image and push it onto Docker and use it.

3. Now , Create yml files ….

  • pvcDeploy.yml file creates PVC for both Grafana and Prometheus respectively
  • Now , create pvcservice.yml file ….
  • Now , create kustomization file to run above files in one click …

then use this command to create all the setup …

kubectl create -k .

the resources have been successfully created, with no error.

4. Now , Launch the Prometheus and Grafana WebUI using respective port no’s:

5. To create Data Source ,Follow these steps :

here fill the url of prometheus , then set Access as Browser .

then data source will be created.

6. Now create a Prometheus graph:

You can write any query and choose any type of visualization.

7. Now to test if the data remains persistent , we delete all the setup …

after it when i refresh prometheus and grafana then …

8. Now if you run kubectl create command again for kustomization.yml file the whole setup will be launched again…

So , Our data remains safe even after deleting and restarting the setup.

Now , the task is successfully completed !!

And we have successfully integrated prometheus and grafana using Kubernetes !!!

--

--

No responses yet