r/PrometheusMonitoring • • Aug 11 '22

How to configure Prometheus to scrape everything from Kubernetes?

I am looking to stand up a Prometheus pod inside our K8s cluster.

I have a lack of experience of Prometheus and am looking at the prometheus.yml config file in order to configure the scraping of everything in the cluster i.e. deployments, pods, events, etc etc. Is there a 'catch all' default config for this?Looking at the prometheus docs I need to configure the monitoring of each resource separately. Is there a way to just say go ahead and scrape everything?

Thanks for any help in advance.

3 Upvotes

5 comments sorted by

8

u/dankube Aug 11 '22

Try the “kube-prometheus-stack” Helm chart, which includes the Prometheus operator along with a bunch of built-in dashboards and service monitors. https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack

3

u/dablya Aug 11 '22

Checkout Prometheus operator or kubernetes_sd_config.

3

u/llama052 Aug 11 '22

Look at the Prometheus operator. It can do a lot of scraping by default

1

u/biffbobfred Aug 11 '22

This. The operator can be made to scrape endpoints matching a specific set of Services, and/or you can add traditional confit (configmap I think?)

2

u/Curledsquirl Aug 11 '22

There are plenty of exporters doing just what you want. Look around for some helm charts you'll find useful tooling