Is there a difference between DO’s block storage and a standard persistent volume in k8s? based on my reading it seems there is. SO for example if I add a PV using the following config:
apiVersion: v1
kind: PersistentVolume # Create PV
metadata:
name: postgres-volume # Sets PV name
labels:
type: local # Sets PV's type
app: postgres
spec:
storageClassName: manual
capacity:
storage: 2Gi # Sets PV's size
accessModes:
- ReadWriteMany
hostPath:
path: "/data/postgresql" # Sets PV's host path
And then proceed to delete the Node then this PV will also be deleted right? But if I was to create the PV using DO’s block storage, would that persist even if node was destroyed?
i.e with:
apiVersion: v1
kind: PersistentVolume # Create PV
metadata:
name: postgres-volume # Sets PV name
labels:
type: local # Sets PV's type
app: postgres
spec:
storageClassName: do-block-storage # DIFF HERE
capacity:
storage: 2Gi # Sets PV's size
accessModes:
- ReadWriteMany
hostPath:
path: "/data/postgresql" # Sets PV's host path
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.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hi there,
Yes, this sounds is correct, if you just create a PV, the data will be stored directly on the node itself. However, if you use a block storage, you would actually spin up new volume which would then be attached to one of your Kubernetes nodes.
Hope that this helps!
Best,
Bobby