Monitoring is base for all the Administrators to identify what is happening in the environment.Today we will see how to monitor Kubernetes cluster with Prometheus and Grafana tools.

Prometheus : It is an open source tool which used to collect real time metrics and modern alerting.
Grafana : It is an open source powerful tool which used for analytics and visualization.

Requirements :

1. Kuberenetes cluster
2. helm

My Environment details,

Kubernetes version : 1.15.3(Single node cluster)
Helm version : 2.16.8

Step 1:
Install Prometheus,

To install Prometheus follow below link,

https://www.devopsart.com/2020/06/step-by-step-to-install-prometheus-in.html

Step 2 :

Install Grafana via helm,


Use below helm command to install grafana,

# helm install  stable/grafana --name grafana



Now wait for few minutes until the pod comes up.

Check the pod status,

# kubectl get pods


The Pod is running fine.

To view the installed application via helm by,

# helm list



Step 3:
Get the Grafana credentials,
To get the grafana admin password, execute this below command,

# kubectl get secret grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo


Step 4 :

Access Grafana and Configure Prometheus,
To access grafana, we need to change the Grafana service from ClusterIP to NodePort,

# kubectl edit svc grafana


# kubectl get svc


Now we have got the port number 31245 to access the Grafana in browser,

URL : kubernetes IP:PORT Number

Here my url is, http://192.168.108.4:31245

Go to the browser and hit the url and it will add the login credentials,

user name : admin

Password : use the password from step3.


Step 5:

Configure Prometheus in Grafana and view the Kubernetes cluster metrics visualization,

After login to Grafana dashboard, add Prometheus as DataSource,



Go to Configuration > Data Sources > Add Data Sources > Select Prometheus

Give the Prometheus details from step 1, then click Save & Test




Next add Kubernetes dashboard to view the metrics,

Under create > import > give 10000 as dashboard id and click load icon.


Next give your Dashboard name, choose Prometheus name as datasource under Prometheus section, then click import.


  Next view the dashboard, Go to Dashboard > Manage > Choose the name,



We have successfully installed Prometheus, Grafana in Kubernetes cluster and we can visualize the data in Grafana Dashboard.


Post a Comment

Previous Post Next Post