- Less preferred: append raw Prometheus scrape jobs via the Helm chart
additionalScrapeConfigsvalues. This works but is fragile across Prometheus upgrades. - Preferred: use ServiceMonitors (Prometheus Operator-native). ServiceMonitors are Kubernetes-native and generally more robust.
additionalScrapeConfigs. This is not a full Prometheus tutorial, but it shows the precise values and files you’ll edit.
Using
additionalScrapeConfigs appends full Prometheus scrape job definitions to the configuration generated by the Prometheus Operator. Because these entries are treated as user-provided config, Prometheus will not validate them for you — an invalid scrape job can prevent Prometheus from starting. Use this option only when ServiceMonitors are unsuitable.
References:
1. Export the Helm chart default values
Generate the default values forkube-prometheus-stack so you can edit them locally:
values.yaml contains all the chart settings. You’ll add your extra Prometheus job definitions under additionalScrapeConfigs.
2. Find additionalScrapeConfigs in the values file
Search values.yaml for additionalScrapeConfigs. The chart documents the setting and includes a warning about upgrade compatibility. A representative excerpt looks like:
prometheus.yml. You are appending full scrape jobs to Prometheus’ configuration.
3. Add your scrape job(s)
Under theadditionalScrapeConfigs key, provide a YAML list of scrape jobs using Prometheus’ scrape_config syntax. For example, to add a job similar to the kube-etcd example, include:
- Ensure
job_nameis unique to avoid confusion. - Use
kubernetes_sd_configswith the appropriaterole(pod, service, node, endpoints) for discovery. - When using TLS or client certs, reference Kubernetes secrets mounted into the Prometheus pod (as shown above).
- Double-check
relabel_configsto avoid removing required labels or routing metrics unintentionally.
4. Apply the updated Helm values
Save your modifiedvalues.yaml and upgrade the Helm release (replace prometheus with your release name if different):
Because
additionalScrapeConfigs injects raw Prometheus job definitions, a malformed job can prevent Prometheus from starting. Validate your scrape configs locally where possible, test with a non-production release, and review Prometheus release notes before upgrading the chart.