Kubernetes “普罗米修斯错误”;服务器返回HTTP状态“401未经授权”;用于远程写入和远程读取

Kubernetes “普罗米修斯错误”;服务器返回HTTP状态“401未经授权”;用于远程写入和远程读取,kubernetes,google-kubernetes-engine,prometheus,influxdb,Kubernetes,Google Kubernetes Engine,Prometheus,Influxdb,我已经在库伯内特斯安装了普罗米修斯,我正在尝试使用远程写入和远程读取选项来创建XDB。我已经在DB中创建了一个用户,该用户还具有读写权限。但是我收到了这样一个错误 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: {\&quo

我已经在库伯内特斯安装了普罗米修斯,我正在尝试使用远程写入和远程读取选项来创建XDB。我已经在DB中创建了一个用户,该用户还具有读写权限。但是我收到了这样一个错误

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"

您在哪里为普罗米修斯定义了自动生成块?我已经定义了这个配置config-map.yaml,并使用kubectl apply-f config-map.yaml应用。根据prometheus.yml:|-我的yaml iI的部分定义了这一点。当我在XDB中禁用Http auth enabled时,它正在工作,但启用它时抛出此错误。您必须在prometheus配置中使用该secret/configMap。