我已经使用prometheus-community/kube-prometheus-stack version 13.10.0
Helm表将Prometheus部署到Kubernetes集群,并且想在/etc/prometheus/
目录下编辑我的prometheus.yml
文件。
这样做的原因是我需要为Jenkins添加一个额外的抓取配置,因为我无法通过一个额外的服务监视器动态地做到这一点。
可以编辑这个文件吗?描述pod,我可以看到文件是由一个秘密创建的。
Volumes:
config:
Type: Secret (a volume populated by a Secret)
SecretName: prometheus-prometheus-kube-prometheus-prometheus
Optional: false
但是我在任何地方都找不到创建这个秘密的模板。
这是一个链接,似乎是一个解决方案:https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/values.yaml#L2108-L2146
我决定提供一些简短的解释,因为有时链接停止工作:
prometheus-community/kube-prometheus-stack
有附加的scrapeconfigs字段。舵图的Yaml文件。
这是它的定义:
## AdditionalScrapeConfigs allows specifying additional Prometheus scrape configurations. Scrape configurations
## are appended to the configurations generated by the Prometheus Operator. Job configurations must have the form
## as specified in the official Prometheus documentation:
## https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config. As scrape configs are
## appended, the user is responsible to make sure it is valid. Note that using this feature may expose the possibility
## to break upgrades of Prometheus. It is advised to review Prometheus release notes to ensure that no incompatible
## scrape configs are going to break Prometheus after the upgrade.
##
## The scrape configuration example below will find master nodes, provided they have the name .*mst.*, relabel the
## port to 2379 and allow etcd scraping provided it is running on all Kubernetes master nodes
##
additionalScrapeConfigs: []