Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Why do my databases disappear after deployments?
I have a 1 replica PostgreSQL (alpine:latest) instance running. It works great but every time I do a deployment or every time I scale to 0 then back to 1 pod my database disappears.
When I look in the logs I see that the init scripts in
docker-entrypoint-initdb.d are run indicating that the PV is empty; these shoudl only be run if the directory is empty. When I look at the PV its been around for some time:
postgres-data Bound pvc-830e8f59-9628-11e9-88b9-36ca52c85694 3Gi RWO do-block-storage 104d
Nothing else seems to be impacted this way. For example I have minio running as an object store and it keeps its data after deployments or scaling.
Any tips appreciated.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×