Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

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.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgresql-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: do-block-storage
This PVC will dynamically provision a block storage volume of 10Gi in size.
Modify your PostgreSQL deployment to use the PVC for data persistence.
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgresql
spec:
replicas: 1
selector:
matchLabels:
app: postgresql
template:
metadata:
labels:
app: postgresql
spec:
containers:
- name: postgresql
image: postgres:latest
volumeMounts:
- mountPath: "/var/lib/postgresql/data"
name: postgresql-storage
env:
- name: POSTGRES_DB
value: "your_database"
- name: POSTGRES_USER
value: "your_user"
- name: POSTGRES_PASSWORD
value: "your_password"
volumes:
- name: postgresql-storage
persistentVolumeClaim:
claimName: postgresql-pvc
Deploy the PVC and PostgreSQL resources:
kubectl apply -f pvc.yaml
kubectl apply -f postgresql-deployment.yaml
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