- The less ideal approach: use the chart’s
additionalScrapeConfigsto append raw Prometheus scrape jobs to the server configuration. - The preferred approach: use ServiceMonitors, the Prometheus Operator–native, declarative way to add targets.
Using
additionalScrapeConfigs means you are appending raw Prometheus scrape configuration. The chart does not validate these entries and upgrades could potentially break if the scrape config is incompatible with future Prometheus changes. Prefer ServiceMonitors for a more robust, operator-friendly solution.- Dump the chart’s default values so you can edit them:
- Open
values.yamland search foradditionalScrapeConfigs. This field lets you append Prometheus scrape jobs. The chart will not validate the contents, so ensure the jobs are valid Prometheus configuration blocks.
- The
kubernetes_sd_configsandrelabel_configsentries follow Prometheus server configuration syntax. - You must ensure the configuration is valid YAML and valid Prometheus config; the chart will not validate it for you.
- Replace the service/port names and relabel rules to match how your application is exposed in Kubernetes.
- Apply the updated values by upgrading the Helm release:
ServiceMonitors provide a declarative, Operator-native way to add targets to Prometheus and are generally the recommended approach.