Kubernetes how to add scrape_configs to the running Prometheus?

Hi All,

Cluster information:

Kubernetes version: k3s v1.23.2
Cloud being used: bare-metal
Installation method: helm
Host OS: Proxmox (VMs: Ubuntu 20.04)

k3s 1 master, 2 workers

I am new to Kubernetes and Prometheus.

Prometheus installed by using the helm chart

How can I add/patch an additional scrape_configs to the running Prometheus?

scrape_configs:
- job_name: master-node
  scrape_interval: 15s
  static_configs:
  - targets: ['10.10.5.70:9100']
  metrics_path: /metrics

It uses prometheus-prometheus-kube-prometheus-prometheus (secret) for configuration.

Couldn’t find any way to add targets outside of the k3s cluster to the helm Prometheus. It seems that the helm installation is only for the targets in the kubernetes cluster environment, so it doesn’t fit my needs.
I ended up installing Prometheus with yaml(s) w/o the operator. Learned a lot comparing to the helm installation. Now I have a freedom of installing only necessary components which I understand and any target that I wish by adding them to the ConfigMap. For my small environment I do not need that enormous helm Prometheus deployment with myriads of questionable scrape jobs/alerts and metrics. This is when I started to understand Grafana/Prometheus dashboards.

1 Like

can you please share the solution how to add those scrape config…even i need to add this config in kubernetes @lk7777