The migration hook fails with `psql: error: connection to server at "shop-postgres" (10.96.12.4), port 5432 failed: Connection refused` on first install.
IntermediateTroubleshootingHooks, Tests, GitOps & Secrets
Answer
Likely causes → The hook runs as pre-install (DB does not exist yet), or as post-install without --wait and before Postgres is ready.
Diagnose → helm get hooks shop -n shop | grep 'helm.sh/hook:'; kubectl get pods -n shop timestamps.
Fix → Use post-install,pre-upgrade and add an init container that loops on pg_isready -h shop-postgres -p 5432 before migrating.
Prevent → Treat DB readiness as an explicit dependency in hooks.
More on Hooks, Tests, GitOps & Secrets
`Error: INSTALLATION FAILED: failed post-install: job failed: BackoffLimitExceeded`Beginner`Error: UPGRADE FAILED: pre-upgrade hooks failed: timed out waiting for the condition`Intermediate`Error: UPGRADE FAILED: pre-upgrade hooks failed: warning: Hook pre-upgrade shop/templates/migrate-job.yaml failed: jobs.batch "shop-migrate" already exists`BeginnerOn upgrade, the migration Job runs the **old** SQL even though the chart contains new migration files.Advanced`helm test` fails with `Error: unable to get pod logs for shop-test-api: pods "shop-test-api" not found`.Intermediate`helm test` hangs until timeout.Beginner