Hello all! I’m still very much learning the basics of kubernetes so forigve this question.
I have an application deployed to a digital ocean kubernetes cluster. One of the deployments in the cluster is a mongodb database using the mongo image from docker hub.
I’m trying to figure out how I can persist the data such that if I restart the mongo deployment / pod the data is not lost… Trying to google this is making me feel all kinds of dumb. I’m guessing the solution has something to do with block storage volumes? Any nudge in the right direction would be beyond 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!
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.
I feel your pain, you need to read up on persistent volumes (pv) and persistent volume claims (pvc).
Block storage is something DO sells you PV is the connection from the block storage to kubernetes PVC is a pod making a claim on that storage all or in part so it is usable by an application.
You can also have storage on a (node) droplet but if the node goes away so does your data. Block storage -> pv -> pvc is the best way.
Good luck.
Digital ocean provides a “storage class” that automates the provisioning of the block storage to your cluster. Now I do not know this for certain, I do believe that you can tell the cluster not to auto provision. I am pretty sure you can manually provision the DO block storage from the previous cluster to the new cluster, and recreate the pv from that physical device. This would never be an automated procedure. You would have to dig into the docs further and learn more than just creating deployment yaml files etc. I haven’t done this yet. There is a great kubernetes slack channel, and there is a specific digital ocean channel. There are some staff from DO that hang out there and help.