Discovery.kubernetes does not have cronjobs or jobs roles

Hello there,

I am learning how to setup Grafana Alloy stack. I would like to have a system that scrape all the resources in my K8s cluster, such as Deployments, Cronjobs and its underlying Jobs, and of course Pods. The problem is that I only see pods as a discovery role into the documentation, so I am a bit lost.

I cannot understand that Alloy is capable of scraping Nodes, Pods, Services, etc… but not resources like Deployment or Cronjobs.
I might be missing something.

Any help will be very much appreciated !
This project looks very promising !

Best regards.

Sources :
Documentation - discovery.kubernetes
Documentation - Collect Prometheus metrics

The discovery components are there to find things to ask for metrics, so services or pods or other things that will respond to an http request.

Are you looking to get information about which of those types of objects exist? As in, have a record about which deployments exist and the pods that belong to them? If so, what you want to do is deploy kube-state-metrics and then configure Alloy to scrape the KSM service. KSM makes metrics that represent the objects in the cluster.

Alternatively, you could use the k8s-monitoring Helm chart, which includes kube-state-metrics, Alloy, and the configuration required to scrape the metrics and logs from your cluster.

1 Like

Thank you for your answer!

Have a nice day !
Thibault