<p>I have installed Prometheus in Kubernetes and I am trying to use remote_write and remote_read option to InfluxDB. I have created a user in DB with read and write privilege also.  But I am receiving an error like this</p>
<pre><code>http://url:port/api/v1/prom/write?db=dbname&amp;u=xxx&amp;p=yyy msg=non-recoverable error&quot; count=100 err=&quot;server returned HTTP status 401 Unauthorized: {\&quot;error\&quot;:\&quot;authorization failed\&quot;}&quot;
</code></pre>
<p>and my configuration for prometheus is</p>
<pre><code> prometheus.yml: |-
global:
  scrape_interval: 5s
  evaluation_interval: 5s
rule_files:
  - /etc/prometheus/prometheus.rules
remote_write:
  - url: &quot;http://url:port/api/v1/prom/write?db=dbname&amp;u=xxxx&amp;p=yyy&quot;
  
remote_read:
  - url: &quot;http://url:port/api/v1/prom/read?db=dbname&amp;u=xxx&amp;p=yyy&quot;
</code></pre>

Jayanth
<p>You could define your secret as volume:</p>
<pre><code> volumeMounts:
    - name: prometheus-secret
      readOnly: true
      mountPath: &quot;/etc/prometheus-secret&quot;

then use it in your prometheus yaml config as:

basic_auth:
   password_file: &quot;/etc/prometheus-secret&quot;
</code></pre>
