Prometheus, Grafana and Kubernetes
This is the 5th task of DevOps Assembly Lines. The main objectives of this task are:
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
Let us try to follow the steps and complete all the requirements of this task.
The first step is to create the YAML files for the respective services and resources. All the YAML files have been listed below:
Grafana Service:
Grafana PVC:
Grafana Deployment:
Prometheus Service:
Prometheus PVC:
I have created this PVC to store the data of Prometheus persistently. But here, we have to create one more resource which is Config Map. The configuration file of Prometheus will be made persistent using Config Map:
Prometheus ConfigMap:
Prometheus Deployment:
I have arranged all these files in a Kustomization file so that all these resources and services can be launch in one click only.
The second step is to launch all these resources and services using the above command:
“Kubectl create -k .”
And the above services+resources will be launched:
This is the first screen of Prometheus:
Here, I am monitoring a different system having IP Address = 192.168.43.93. If we want that Prometheus should scrap data from this node, we have to install and run a “node exporter” program on that node.
The first screen of Grafana:
Here, the default username is “admin” and the password is also “admin”. After entering the username and password, it will ask us to change the password:
After logging in, this is the first screen of Grafana:
Thus, we have successfully fulfilled all the requirements for this task.
I hope you liked this article. Thank you :)