作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
根据 Prometheus-operator documentation我们应该能够通过 secret 文件轻松提供我们的额外配置。这一步真的有人成功吗?我有几个问题:
file_sd_configs:
提供额外的文件(json 配置)吗?如果是这样,如何将这些文件提供到普罗米修斯 list 文件中? cat prometheus-additional.yaml
- job_name: "prometheus-custom"
static_configs:
- targets: ["localhost:9090"]
kubectl create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
name: prometheus
spec:
replicas: 2
resources:
requests:
memory: 400Mi
additionalScrapeConfigs:
name: additional-scrape-configs
key: prometheus-additional.yaml
kubectl apply -f prometheus.yaml
kubectl logs prometheus-prometheus-0 -c prometheus
level=info ts=2019-12-05T18:07:30.217852541Z caller=main.go:302 msg="Starting Prometheus" version=" (version=2.7.1, branch=HEAD, revision=62e591f928ddf6b3468308b7ac1de1c63aa7fcf3)"
level=info ts=2019-12-05T18:07:30.217916972Z caller=main.go:303 build_context="(go=go1.11.5, user=root@f9f82868fc43, date=20190131-11:16:59)"
level=info ts=2019-12-05T18:07:30.217971648Z caller=main.go:304 host_details="(Linux 4.19.3-300.fc29.x86_64 #1 SMP Wed Nov 21 15:27:25 UTC 2018 x86_64 prometheus-prometheus-0 (none))"
level=info ts=2019-12-05T18:07:30.217994128Z caller=main.go:305 fd_limits="(soft=1048576, hard=1048576)"
level=info ts=2019-12-05T18:07:30.218236509Z caller=main.go:306 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2019-12-05T18:07:30.219359123Z caller=main.go:620 msg="Starting TSDB ..."
level=info ts=2019-12-05T18:07:30.219487263Z caller=web.go:416 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2019-12-05T18:07:30.230944675Z caller=main.go:635 msg="TSDB started"
level=info ts=2019-12-05T18:07:30.231037536Z caller=main.go:695 msg="Loading configuration file" filename=/etc/prometheus/config_out/prometheus.env.yaml
level=info ts=2019-12-05T18:07:30.23125837Z caller=main.go:722 msg="Completed loading of configuration file" filename=/etc/prometheus/config_out/prometheus.env.yaml
level=info ts=2019-12-05T18:07:30.231294106Z caller=main.go:589 msg="Server is ready to receive web requests."
level=info ts=2019-12-05T18:07:33.568068248Z caller=main.go:695 msg="Loading configuration file" filename=/etc/prometheus/config_out/prometheus.env.yaml
level=info ts=2019-12-05T18:07:33.568305994Z caller=main.go:722 msg="Completed loading of configuration file" filename=/etc/prometheus/config_out/prometheus.env.yaml
最佳答案
事实证明,prometheus-operator 仍然依赖于 serviceMonitorSelector: {}
根据此 ticket 的 list 文件的一部分.因此,为了添加额外的配置,我们需要有以下 list :
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
name: prometheus
spec:
replicas: 2
resources:
requests:
memory: 400Mi
additionalScrapeConfigs:
name: prometheus-config
key: prometheus-config.yaml
serviceMonitorSelector: {}
prometheus-config.yaml
将包含普罗米修斯抓取规则并通过 secret 部署到普罗米修斯集群。我还凭经验发现当前的 prometheus-operator 不支持
file_sd_configs
在 prometheus 配置中(悲伤),有人需要在
prometheus-config.yaml
中编写完整的规则文件。
关于configuration - 如何为 prometheus 运算符(operator)启用其他配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59201108/
我是一名优秀的程序员,十分优秀!