How to add a static_config to the promethes deployed by helm?

42 views
Skip to first unread message

kazakaze

unread,
Sep 17, 2021, 6:42:08 AM9/17/21
to Prometheus Users
My prometheus is deployed via helm-charts 

# kubectl  get po -n monitor
NAME                                                     READY   STATUS    RESTARTS      AGE
alertmanager-prometheus-stack-kube-prom-alertmanager-0   2/2     Running   8 (19d ago)   74d
prometheus-prometheus-stack-kube-prom-prometheus-0       2/2     Running   9 (19d ago)   74d
prometheus-stack-grafana-56b797cc96-sgspf                2/2     Running   8 (19d ago)   74d
prometheus-stack-kube-prom-operator-cfbf6c47f-mjr6m      1/1     Running   4 (19d ago)   74d
prometheus-stack-kube-state-metrics-67889f75bd-tl6k7     1/1     Running   4 (19d ago)   74d
prometheus-stack-prometheus-node-exporter-r77qj          1/1     Running   4 (19d ago)   74d

I started the  example  through go run, and I know that scrape_configs needs to be modified. My question is:
1. It seems that I need to encapsulate the program into a mirror image and add a new crawl through PodMonitor/ServiceMonitor? Must it be packaged as a mirror image?
2. How to automatically modify scrape_configs, if I want to manually, which pod should I exec to?




Harald Koch

unread,
Sep 17, 2021, 4:55:35 PM9/17/21
to Prometheus Users
On Fri, Sep 17, 2021, at 06:42, kazakaze wrote:
My prometheus is deployed via helm-charts 

[...]

2. How to automatically modify scrape_configs

Since I just pieced this together myself last week, I'll share. :) If you're using kube-prometheus-stack (which you should be):

helm show values prometheus-community/kube-prometheus-stack

Will give you a list of all configuration values for the helm chart. The one you're looking for is prometheus.prometheusSpec.additionalScrapeConfigs.

--
Harald

Reply all
Reply to author
Forward
0 new messages