why use configmap with db user pass for k8s postgres

3/4/2019

I am trying to deploy postgres on docker with PV and PVCs.

What is the purpose of using DB_USER and PASSWORD env variables?

(ref. https://severalnines.com/blog/using-kubernetes-deploy-postgresql)

I just want API to connect to service hosted with k8s with credentials known.

-- Pat
kubernetes

1 Answer

3/4/2019

If you look inside the script docker-entrypoint.sh that runs inside the postgresql container on boot, you'll notice that it contains these paramaters:

--username "$POSTGRES_USER" --dbname "$POSTGRES_DB" --host "$POSTGRES_HOST" --password "$POSTGRES_PASSWORD"

If during boot of psql container, these environment variables are present, it initializes the psql server with those attributes else it initializes with default attributes.

-- vancleff
Source: StackOverflow