You must be getting that config snippet into prometheus via the helm chart 
somehow.  If you are just providing the snippet verbatim, then you could do 
some preprocessing of it. If there's no hook to do this at deployment time 
via the helm chart, then you could do it at runtime, e.g. via an init 
container.

Note that prometheus very recently (v2.43.0 
<https://github.com/prometheus/prometheus/releases/tag/v2.43.0>) added the 
ability to read additional scrape config files referenced from the main 
config file:

# Scrape config files specifies a list of globs. Scrape configs are read 
from # all matching files and appended to the list of scrape configs. 
scrape_config_files: [ - <filepath_glob> ... ]


On Sunday, 23 April 2023 at 21:38:24 UTC+1 Christian Oelsner wrote:

Oh,

You mentioned that there might be a way to sort in the helm chart....
I am using the "official" helm chart, and while there might be a way to 
accomplish it, i have yet to find it.
I will keep digging aroung though :)

/Oelsner

søndag den 23. april 2023 kl. 22.36.46 UTC+2 skrev Christian Oelsner:

Hi again Brian,
That worked nicely for the password :)

Now i just need to figure out a way to something similar with username, as 
i know that my organization architects will be poiting fingers at me if i 
commit something to git with a username in it :)

Your help is as usual much appreciated :)

Best

Christian Oelsner

lørdag den 22. april 2023 kl. 21.00.04 UTC+2 skrev Christian Oelsner:

Hello Brian,
thank you for your input. I will give a try and see where that takes me :) 

Best regards
Christian Oelsner

lørdag den 22. april 2023 kl. 00.43.16 UTC+2 skrev Brian Candler:

> But for the life of me, i cant seem to get prometheus to pick it up in 
the scrape job.
> Am i missing the obvious?

Environment-variable substitution is not performed in prometheus' config 
file.

You could expose the secret containing the password as a file, rather than 
an environment variable:
https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod

basic_auth:
  username: some_static_username
  password_file: /path/to/file

The username, though, still has to be included inline.

Since you're deploying via helm, there might be some way the helm chart 
lets you insert these values into the prometheus configuration.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/a462ae23-39e6-48c3-9039-7de2f4f709fen%40googlegroups.com.

Reply via email to