In this step by step tutorial you learn how to monitor any third-party application in your Kubernetes cluster using Prometheus Monitoring.
In the demo I deploy MongoDB as an example.
CONTEXT:
A typical scenario would be that you have an application deployed in your Kubernetes cluster and at some point you decide that you want to monitor it using Prometheus.
Pre-requisites:
- Minikube cluster installed (How to install Minikube)
- Demo part 1: In the first part of the demo we have already deployed Prometheus Operator using Helm and I explained all the components, which were created. (Part 1 of the demo)
Steps to setup monitoring for MongoDB π
1. Deploy MongoDB Application π
First we will deploy the MongoDB application in our cluster. In order to do that, we need to create a MongoDB Deployment and Service.
2. Expose metrics - deploy MongoDB Exporter
As a second step we need to expose the data or the metrics of the MongoDB application using a component called Exporter.
Each application like MongoDB, Mysql, Redis has its own Exporter.
A Exporter is basically a translator between your apps data to metrics or data that Prometheus understands. It does 2 things:
- It collects the metrics data from the app and converts it to Prometheus understandable data
- It exposes these metrics to /metrics endpoint for Prometheus to be able to scrape it.
3. Allow Prometheus π₯ to scrape metrics - Deploy ServiceMonitor
Once the metrics are exposed through the MongoDB exporter, we allow Prometheus to scrape these data. This is done using a component called Service Monitor.
4. View the scraped data in Prometheus UI and Grafana π
Finally, when we have configured the above we will see the new target in Prometheus UI and I also show the scraped data in Grafana UI.
Explaining all the concepts π‘
Along the process I explain all the concepts in detail, like
- What is a Exporter?
- What is a ServiceMonitor?
- How Prometheus discovers new targets? So that you understand those concepts and afterwards see how to use it in practice.
Watch the full video here π€
βΊ Kubernetes 101: Compact and easy-to-read ebook bundle π
It's a handy way to quickly look something up or refresh your knowledge at work and use it as your cheatsheet π
Like, share and follow me π for more content: