kubernetes - 远程写入和远程读取的 Prometheus 错误“服务器返回 HTTP 状态 401 未授权”
问题描述
我已经在 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"
推荐阅读
- delphi - 在对象检查器集合编辑器中检测所选项目
- google-analytics - 为什么按月的 %new session 与按该月每天的平均 %new session 不同
- django - 使用 docker-compose 中的命令导出后,bash 中没有环境变量
- django - 如何在 Django 管理表单中添加自定义操作按钮并发布信息
- html - 如何在我的网站上响应地调整 power bi 视觉效果
- netezza - 带有管道分隔文件的 Netezza 合并表
- mysql - Mysql分区对DDL和DML的影响
- list - 如何回答每行包含多个答案的交互式提示
- react-native - 使用 CodePush 的 Sentry React-Native 不使用源映射
- airflow - 气流,在当前 dag 运行中获取任务的当前状态