PROMETHEUS AND GRAFANA ON KUBERNETES !!

Mansisaini
3 min readAug 28, 2020

TASK-5

So, let’s talk about something on prometheus and grafana.

Prometheus stores the data from different metrics of system in a time series database and grafana on the other hand visualises it by making some beautiful dashboards.

So, Here the task is:-

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

So, here’s my yml file to launch prometheus inside kubernetes, but before we launch pod of prometheus, let me tell you one thing that we have to first create one configmap file so that dynamically prometheus can be configured with all the target ports set.

Now, we are all set to launch prometheus through our yml file and also we have created a pvc so that our data of prometheus remains persistent:-

Now we’ll run our kubectl command to run our yml file to launch prometheus pod like kubectl create -f <filename.yml>.

So, this is the output of our kubectl get all command after we have successfully launched the proemtheus:-

Now we can access our prometheus at 198.168.99.100:31001 (minikube ip and port which have given )

Let’s do something inside prometheus, we have retrieved how much memory is free in our target node.

Graphically:-

Now, we’ll launch grafana through yml file on the top of kubernetes also we have created a pvc so that our data of grafana remains persistent.

So the output of our kubectl get all :-

Now we can access our beautiful grafana dashboard at 198.168.99.100:31002 (minikube ip and port which have given )

Now we will connect our grafana with prometheus so that it can retrieve metrics.

After creating dashboard, we we have visualised the metrics retrieved from prometheus:-

Now, we have successfully done our task !!

Thank You !

--

--