Deploying Grafana & Prometheus in K8s

No alt text provided for this image

PREFACE: -

Grafana is an open-source, general-purpose dashboard and graph composer, which runs as a web application. Grafana allows you to query, visualize, alert on and understand your metrics no matter where they are stored. Create, explore, and share dashboards with your team and foster a data-driven culture.

Prometheus is an open-source system monitoring and alerting toolkit originally built at SoundCloud. Since its inception in 2012, many companies and organizations have adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project and maintained independently of any company.

In this article, we will deploy Grafana & Prometheus to Kubernetes cluster and collected node metrics and connect them. I will use Minikube for deploying Grafana and Prometheus.

Prometheus: -

> Create a Prometheus Deployment.

kubectl create deployment myprom --image=vimal13/prometheus

Here, i used this image which is downloaded from Docker Hub.

> Exposing Prometheus as a Service

kubectl expose deployment myprom --type=NodePort --port=9090

To access the Prometheus dashboard over an IP or a DNS name, you need to expose it as Kubernetes service.

> 192.168.99.100 is my Minikube IP. You should discover yours:

$minikube ip


No alt text provided for this image
  • But basically Prometheus is not for monitoring,the main feature is to pull data from exporter w.r.t time and store a database which is also known as TSDB.

Grafana: -

> Now let’s deploy Grafana:

kubectl create deployment mygrafana --image=vimal13/grafana

> Exposing Prometheus as a Service:

kubectl expose deployment mygrafana --type=NodePort --port=3000

Now, we have to check our service ports-

kubectl get service
No alt text provided for this image

Now we can type our ip:30518 in our browser and access Grafana (default username and password is admin/admin).

No alt text provided for this image

And, finally, let’s add a dashboard to Grafana using metrics from Prometheus.

So, here we have some different Visualizations of certain PromQuery we put.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
  • Grafana is designed for analyzing and visualizing metrics such as system CPU, memory, disk and I/O utilization. Grafana does not allow full-text data querying.
  • Learn about the Grafana , it is great for visualization as human beings understand more using visual.

This helps monitoring more simple.

Prometheus records real-time metrics in a time series database and Grafana helps in analyzing and visualizing metrics in customizable and presentable dashboards.

We deploy 90% of the tools on k8s in today's world, so this great use case.

Thank you for reading!

要查看或添加评论,请登录

Anubhav Pahwa的更多文章

社区洞察

其他会员也浏览了