I have created username and password under vault and mount those secrets under secret name my_sec in k8 pod.
Then I injected that secret (my_sec) inside my blackbox container. When I ran printenv , I can also see env variables - username and password along with it’s value.
However, when I use/reference username and password environment variables under my blackbox configuration http_2xx module ( as mentioned below), environment variables $(username) and $(password) are not replaced by it’s value.
Can someone please assist me with the proper syntax or configuration, I should use to make environment variables working under blackbox http_2xx module.
basic_auth:
Username: $(username)
Password: $(password)
Thanks in advance. Nivedita
I have created username and password under vault and mount those secrets under secret name my_sec in k8 pod.
Then I injected that secret (my_sec) inside my blackbox container. When I ran printenv , I can also see env variables - username and password along with it’s value.
However, when I use/reference username and password environment variables under my blackbox configuration http_2xx module ( as mentioned below), environment variables $(username) and $(password) are not replaced by it’s value.
Can someone please assist me with the proper syntax or configuration, I should use to make environment variables working under blackbox http_2xx module.
basic_auth:
Username: $(username)
Password: $(password)
Thanks in advance. Nivedita
Share edited Feb 17 at 8:09 jam j 5662 silver badges18 bronze badges asked Feb 14 at 19:19 NiveditaKNiveditaK 537 bronze badges 1 |1 Answer
Reset to default 0Prometheus does not support environment variables for other fields than proxy settings in http_config. If you add the secrets to your blackbox exporter, you can use username_file
and password_file
.
basic auth:
username_file: <path_to_username_secret>
password_file: <path_to_password_secret>
Example:
basic auth:
username_file: /run/secrets/my_username
password_file: /run/secrets/my_password
The documentation is available here, it should answer any other questions regarding options you may have.
${var}
syntax for variables, env vars are not supported there, sadly. If you have secret files, you could specify e.g.username_file: /run/secrets/my_username
– thecarpy Commented Feb 18 at 8:39