I am running Nexus Repository Manager 3 (version 3.77.0, previously 3.76.1) in Kubernetes, using the official Helm chart. I am attempting to migrate from the embedded H2 database to an external PostgreSQL (Cloud SQL) instance.
- The Kubernetes secret for database credentials is correct and matches what works with psql from a debug pod.
- The Nexus pod’s environment variables (
POSTGRES_USER,POSTGRES_PASSWORD, etc.) are set correctly and match the new PostgreSQL user and database. - I can connect to the database from a debug pod using the same credentials.
- However, Nexus fails to start and logs show:
FATAL: password authentication failed for user "nexus" - The logs also show Nexus is still trying to connect as user “nexus” to the old database, even after updating the environment variables and secret to use a new user/database.
- I have not removed or renamed the
nexus.mv.dbfile, as per Sonatype documentation. - I need to preserve all existing data during this migration.
What I’ve Tried:
- Verified all secrets, environment variables, and network connectivity.
- Created a new PostgreSQL user and database, updated the secret, and restarted the pod.
- Confirmed the pod is using the new environment variables.
- Nexus still attempts to connect with the old user/database, not the new ones.
How can I safely migrate Nexus from H2 to PostgreSQL, ensuring it uses the new user/database and preserves all existing data, without removing the H2 files?