普罗米修斯误差" server returned HTTP status 401 Unauthorized" remote_write和remote_read



我已经在 Kubernetes 中安装了 Prometheus,我正在尝试使用 InfluxDB remote_write和remote_read选项。我也在数据库中创建了一个具有读写权限的用户。 但是我收到这样的错误

http://url:port/api/v1/prom/write?db=dbname&u=xxx&p=yyy msg=non-recoverable error" count=100 err="server returned HTTP status 401 Unauthorized: {"error":"authorization failed"}"

我对普罗米修斯的配置是

prometheus.yml: |-
global:
scrape_interval: 5s
evaluation_interval: 5s
rule_files:
- /etc/prometheus/prometheus.rules
remote_write:
- url: "http://url:port/api/v1/prom/write?db=dbname&u=xxxx&p=yyy"

remote_read:
- url: "http://url:port/api/v1/prom/read?db=dbname&u=xxx&p=yyy"

您可以将密钥定义为卷:

volumeMounts:
- name: prometheus-secret
readOnly: true
mountPath: "/etc/prometheus-secret"
then use it in your prometheus yaml config as:
basic_auth:
password_file: "/etc/prometheus-secret"

最新更新