How can I monitoring the Traffic or the requests of the services of my kubernetes cluster

1k Views Asked by At

I'm searching for a way to monitoring my k8s cluster by getting the incoming traffic from the user access to the applications.

My goals is to get information on which services are more requested at what time of the day to build a strategy to better serve the applications.

Is there a way to do this monitoring with Grafana and Promql? Or I will need another tools running on my cluster to store and analyze data?

1

There are 1 best solutions below

0
On BEST ANSWER

Is there a way to do this monitoring with Grafana and PromQL ?
Yes

Is there a native way to do it with k8s ?
No

Being inside a kubernetes cluster has no impact on how to collect your application's metrics (well, of course there are some integration between prom and k8s such as service discovery that simplifies it).

What you need to do is just expose your applications metrics. So, for example, if your apps are developped in Java using Spring, then you need to add Spring actuator in order to expose some basic metrics (this is just an example, there are plenty of solutions to expose metrics).
Now that your applications expose some metrics, you need to add them as target in your prometheus config.

There are some prometheus exporter for kubernetes such as kube-state-metrics that allows you to collect metrics for your cluster, but they don't collect metrics such as the number of request to one service (or i'm not aware of the existence of such exporter).