Hello, I have a problem with postgresql deployed in Kubernetes cluster. In my Persistent Volume YAML file I have this
hostPath:
path: /MyWindows/Directory/data/postgresql
The problem is that this Directory is always empty and the DB is not persistent.
Can you help me please? Thank you Roberto
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.
Hello Roberto!
Usually, when working with Managed Kubernetes instances, it’s recommended to avoid using
hostPath
volumes because they are tied to specific nodes and not suitable for distributed, production-grade environments. Instead, you should use Persistent Volume Claims backed by DigitalOcean Volumes.hostPath
volume only works on a single node and doesn’t persist if the pod is rescheduled to a different node.DigitalOcean integrates with Kubernetes to provide dynamic volume provisioning:
Define a PVC that uses DigitalOcean Block Storage as the backing store.
This PVC will dynamically provision a block storage volume of 10Gi in size.
Modify your PostgreSQL deployment to use the PVC for data persistence.
Deploy the PVC and PostgreSQL resources:
do-block-storage
storage class is available in your cluster. It is automatically created in DigitalOcean Kubernetes clusters.This has several benefits:
hostPath
.Let me know if you run into any issues!
- Bobby