1

I have cloned and started the

https://computingforgeeks.com/setup-prometheus-and-grafana-on-kubernetes/

kube-prometheus project on my local. I want to add additional scrap config to retrieve custom metrics from another source. I found

https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/additional-scrape-config.md

but I cannot change the prometheus.yaml in the pods. I could not find where to change. Can anyone help me get this additional scraper configured in the kube-prometheus project?

I could not find where to add additional scraper as mentioned in the URL above:

Finally, reference this additional configuration in your prometheus.yaml CRD.

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
enter code here

The CRDs I found in the kube-prometheus project all have the informational descriptions but do not take a value. How can I add my additionalScrapeConfigs?

Thanks.

Emrah

  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Apr 22 '22 at 07:47
  • Hope that is more clear. I tried to add more info. Since I did not find where to edit for additionalScrapeConfigs I cannot say where to point to. – Emrah Utku Barkana Apr 26 '22 at 06:07

1 Answers1

0

I guess you may can see kubernetes secret which name is '...-prometheus-scrape-confg'. additional-scrape-configs uses this secret for setting target configs.

When you install the prometheus using 'helm install ...', you may use values.yaml in helm-charts/charts/kube-prometheus-stack/. additionalScrapeConfigs can be set in this file. check 'prometheus.prometheusSpec.additionalScrapeConfigs' in values.yaml file.

So, if you add any target addresses to additionalScrapeConfigs in values.yaml, it will be created as secret and prometheus uses it to make prometheus.yaml file. If you want to check, put some target addresses to additionalScrapeConfigs and execute 'helm upgrade ...' or 'helm install ... ' again.

  • Thanks for the response. But this is not a Helm install. If you have checked setup-prometheus-and-grafana-on-kubernetes URL, you can see bunch of yaml files under manifests and also under manifests/setup. CRDs are under manifests/setup folder where I have found the definitions of **bold** `additionalScrapeConfigs` but those are just templates where I cannot write the value. I could not find where to add that **bold** `additionalScrapeConfigs`. **bold** `additional-scrape-configs` is a secret generated from **bold** `prometheus-additional.yaml` under the same namespace. – Emrah Utku Barkana Apr 28 '22 at 19:04