By jasonleach
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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
You need to make sure that you have your volumeMounts and mountPath set up correctly in your deployment file so that the PostgreSQL data folder is actually mounted on your PV.
If you wish you could share your yaml file here so that I could try to advise you further.
Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.