1

Previously when I using the Bitnami Helm chart by way of Terraform to deploy PostgreSQL, I would have a database created. Now I no longer have a database created. I'm using

  • same connect string
  • same usernname
  • same password

But I am getting this error in my Kubernetes logs,

psql: error: FATAL: database "foo" does not exist

Why is it that I no longer have an initial database?

Evan Carroll
  • 65,432
  • 50
  • 254
  • 507

1 Answers1

0

The reason is that is because

POSTGRES_USERNAME=foo
POSTGRES_PASSWORD=foo
POSTGRES_DATABASE=foo

Works slightly different from,

POSTGRES_USERNAME=foo
POSTGRES_PASSWORD=foo

They both

  • create the foo user and password
  • will default to connecting to foo when you auth with user foo

But only one of them creates the database on initial run. From the Bitnami documentation on the PostgreSQL chart,

By passing the POSTGRESQL_DATABASE environment variable when running the image for the first time, a database will be created. This is useful if your application requires that a database already exists, saving you from having to manually create the database using the PostgreSQL client.

Evan Carroll
  • 65,432
  • 50
  • 254
  • 507