Prometheus PostgresSQL exporter without SSL and with password from Kubernetes secret

11/26/2019

I would like to scrape metrics off a PostgreSQL server with Prometheus' postgres_exporter. The exporter runs inside a Kubernetes pod.

Since it should take the PostgresSQL password from a Kubernetes secret, I rely on environment variables DATA_SOURCE_URI, DATA_SOURCE_USER, DATA_SOURCE_PASS. (I.e. DATA_SOURCE_URI instead of DATA_SOURCE_NAME, because DATA_SOURCE_PASS, which is filled from the secret, only works in combination with the first.)

But DATA_SOURCE_URI apparently assumes SSL, and it does not allow parameters such as sslmode=disable. My database currently does not support SSL, so the connection fails.

My question is this: Can DATA_SOURCE_URI be used for connecting to a database without SSL, and if so how?

-- rookie099
kubernetes
postgresql
prometheus

0 Answers