225464 (3) [Avatar] Offline
#1
Hello,

It's quite clear from section 6.4 that we can use a GCE persistent disk to retain data so that it's
available even when the pod is rescheduled to another node and the examples show how we can create another node and still access the data. Great!

However the text is less clear about what happen when using persistent volumes.

The text states: We actually told Kubernetes we wanted our PersistentVolume to behave like this when we
created it - by setting its persistentVolumeReclaimPolicy to Retain. This means we wanted
Kubernetes to retain the volume and its contents after it is released from its claim. As far as
I’m aware, the only way of manually recycling the persistent volume to make it available again
is to delete and recreate the PersistentVolume resource. As you do that, it’s your decision
what to do with the files on the underlying storage – you can either delete them or leave them
alone, so they can be re-used by the next pod


This would suggest that we can delete the persistent volume and provision a new one, using the same underlying storage and the data should still be there and available. However, the text goes on to say: There are two other possible reclaim policies: Recycle and Delete. The first one deletes the volume’s contents and makes the volume available to be claimed again. This way, the PersistentVolume can be re-used multiple times by different PersistentVolumeClaims and different Pods

There is some confusion here, at least for me, as this would seem to suggest that the data in the underlying storage is deleted
- deletes the volume's contents. Is that the case and if so, why would we want to use this method?

FYI, one of the best books in the 'In Action' series.