1

How can I configure Postgres helm chart to execute custom init scripts to setup the db while deploying the application to cluster.

I have multiple *.sql scripts which gets executed by init.sh. dir structure

/init
    - 001/*.sql
    - init.sh

Any suggestion where I could mount script dir to /docker-entryinitdb.d path or any other possible solution. How can this implemented with Postgres Helm Chart

https://github.com/bitnami/charts/blob/main/bitnami/postgresql/values.yaml

While using ConfigMaps, size could become an issue for me as number of scripts might grow and --set initdb.script is best for small script/commands.

3
  • Can you run migrations via your application framework instead? That will help you incrementally update your database schema without needing to destroy and recreate the database, and will work well in non-Kubernetes contexts as well. Commented Sep 19, 2023 at 17:30
  • Also see PostgreSQL in Helm: initdbScripts Parameter for what bitnami/postgresql supports, but note that it requires embedding the init scripts directly into Helm values and hits the ~1 MB Kubernetes object size limit. Commented Sep 19, 2023 at 17:32
  • yes for now, I am trying to avoid using initdbscripts as there are multiple scripts Commented Sep 19, 2023 at 19:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.