【发布时间】:2023-03-22 22:10:01
【问题描述】:
我尝试了基于文件的服务发现,但每次更改配置映射(包含静态目标)时,我都会手动删除 prometheus pod 以获取配置更改。 prometheus 有什么方法可以在不删除 prometheus pod 的情况下自动获取配置更改?对这个问题有任何帮助吗?
我正在使用 helm chart 安装 prometheus-operator target.json 文件
[
{
"labels": {
"app": "web",
"env": "dev"
},
"targets": [
"web.dev.svc.cluster.local"
]
}
]```
command I used to create configmap
kubectl create cm static-config --from-file=target.json -n monitoring
prometheus-operator.yaml
```volumes:
- name: config-volume
configMap:
name: static-config
volumeMounts:
- name: config-volume
mountPath: /etc/prometheus/config
additionalScrapeConfigs:
- job_name: 'file-based-targets'
file_sd_configs:
- files:
- '/etc/prometheus/config/target.json'```
【问题讨论】:
标签: kubernetes prometheus service-discovery prometheus-operator