为 prometheus 客户端添加 auth 或禁用 /metrics 端点

pan*_*ejk 6 openshift prometheus

我在 OpenShift 平台上使用 Prometheus。身份验证由 OpenShift for Prometheus 及其所有子域(/metrics 端点除外)处理。它绕过所有身份验证并以纯文本形式显示 Prometheus go 客户端指标。

是否可以以某种方式强制在 prometheus/metrics 端点上进行 OpenShift 身份验证或禁用该端点,因为我实际上并不需要 go 客户端指标?

我知道 node_exporters 有控制某些收集器的标志,但我找不到 Prometheus 客户端本身的标志。

Har*_*hah 1

我不确定 openshift 身份验证,但您可以将基本身份验证添加到“/metrics”端点。另外,prometheus 也可以支持 TLS。

将以下内容添加到 prometheus 配置文件中的“scrape_config”部分(默认为 prometheus.yml)

basic_auth:
    username: "admin"
    password: "password"
Run Code Online (Sandbox Code Playgroud)

更多信息可以在此处链接的官方普罗米修斯文档中找到