<p>I want to add an additional scrape config into Prometheus. I have followed the below method.</p>
<p><a href="https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/additional-scrape-config.md" rel="nofollow noreferrer">https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/additional-scrape-config.md</a></p>
<p>First, created a file prometheus-additional.yaml and added the new config</p>
<pre><code>- job_name: &quot;prometheus&quot;
  static_configs:
  - targets: [&quot;localhost:9090&quot;]
</code></pre>
<p>Secondly, created a secret out of it.</p>
<pre><code>kubectl create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml --dry-run -oyaml &gt; additional-scrape-configs.yaml
</code></pre>
<p>Then created the secret using the below command</p>
<pre><code>kubectl apply -f additional-scrape-configs.yaml -n monitoring
</code></pre>
<p>Then in the above link it says</p>
<p><strong>&quot;Finally, reference this additional configuration in your prometheus.yaml CRD.&quot;</strong></p>
<pre><code>apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
  name: prometheus
  labels:
    prometheus: prometheus
spec:
  replicas: 2
  serviceAccountName: prometheus
  serviceMonitorSelector:
    matchLabels:
      team: frontend
  additionalScrapeConfigs:
    name: additional-scrape-configs
    key: prometheus-additional.yaml
</code></pre>
<p>Where I can find the above? Do I need to create a new CRD? Can't I update the existing running deployment?</p>

Container-Man
<p>This is somehow wrong in the Documentation, you have to use additionalScrapeConfigs<strong>Secret</strong>:</p>
<pre><code>  additionalScrapeConfigsSecret:
    enabled: true
    name: additional-scrape-configs
    key: prometheus-additional.yaml
</code></pre>
<p>Else you get the error <code>cannot unmarshal !!map into []yaml.MapSlice</code></p>
<p>Here is a better documentation:
<a href="https://github.com/prometheus-community/helm-charts/blob/8b45bdbdabd9b54766c4beb3c562b766b268a034/charts/kube-prometheus-stack/values.yaml#L2691" rel="nofollow noreferrer">https://github.com/prometheus-community/helm-charts/blob/8b45bdbdabd9b54766c4beb3c562b766b268a034/charts/kube-prometheus-stack/values.yaml#L2691</a></p>
<p>According to this, you could add scrape configs without packaging into a secret like this:</p>
<pre><code>additionalScrapeConfigs: |
  - job_name: &quot;prometheus&quot;
  static_configs:
  - targets: [&quot;localhost:9090&quot;]
</code></pre>
