Collecting data from apps in Kubernetes

Hello.

How do you solve the problem of building metrics from applications in a Kubernetes cluster? I’m trying to get data from applications in several pods, accessible through the service endpoint using the input plugin prometheus through kubernetes_services.
This works correctly if the service has an endpoint, but the cluster address is not specified - I get a series of data from all applications (3, in my case), separated by the address tag.
However, if the service has a cluster address, I get only one series of data marked with the cluster address, but not the application.

What am I doing wrong?

Config example:
[[inputs.prometheus]]
kubernetes_services = [ “http://some_app:9999/metrics” ]
# and some filters…

Hi,

This is a very specific configuration of the Prometheus plugin that isn’t using the native Kubernetes integrations; which is why you’re seeing this behaviour.

Instead of using that config, use:

[[inputs.prometheus]]
monitor_kubernetes_pods = true
2 Likes

I’d also suggest using my example code as a reference :grinning:

1 Like

can you show me the full config file