Reusing Persistent Volume for another PersistentVolumeClaim

5/22/2017

I am using rookio on Kubernetes with CoreOS for dynamically creating Persistent Volume.

So I create a PersistentVolumeClaim (kubectl create -f postgres-pvc.yaml) and apply a patch for persistentVolumeReclaimPolicy to Retain. I do a "kubectl get pv"and I can see a dynamically created persistentvolume and is bound. Now when I delete the PersitentVolumeClaim the status goes to Released.

I have stored some precious data in that persistentvolume. Is there a way I can reuse that persistentvolume that has gone into Released status?

thanks -sonam

-- Sonam
kubernetes
persistent-volume-claims
persistent-volumes
postgresql

1 Answer

5/23/2017

If you have precious data that you want to use in another PostgreSQL pod, maybe StatefulSets is which you are looking for, as it allows:

Stable, persistent storage [...] across Pod (re)schedulings.

Therefore, I would advise you to deploy your PostgreSQL database as a StatefulSet. You would need to check that your already existing Volume is bound.


[1] https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/

-- Javier Salmeron
Source: StackOverflow