PV reclaim policies¶
PV reclaim policies (PersistentVolume reclaim policies) determine the lifecycle management of a PersistentVolume (PV) after the [[PersistentVolumeClaim]] (PVC) bound to it is deleted^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
When a PVC is deleted, the associated PV transitions to a specific status based on the configured reclaim policy^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. This policy dictates whether the underlying storage is retained for manual recovery, scrubbed for reuse, or automatically deleted along with the PV object^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
Policy Types¶
Retain¶
The Retain policy enables manual resource reclamation^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
When a PVC is deleted under this policy, the PV transitions to a Released status^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. The volume and its data remain intact, but the storage is not automatically made available to other claims^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. An administrator must manually handle the data (e.g., backing up or wiping it) and then manually delete the PV to allow the underlying storage to be reclaimed and reprovisioned for a new claim^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
Recycle¶
The Recycle policy was a basic automated reclamation method^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
This policy effectively scrubbed the volume by executing a command equivalent to rm -rf /thevolume/*^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. Once scrubbed, the PV would be made available to be bound by a new PVC^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. This feature has been deprecated; the recommended modern alternative is to use Dynamic Provisioning via StorageClass^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
Delete¶
The Delete policy relies on automatic removal of both the Kubernetes object and the associated storage asset^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
When this policy is active, deleting the PVC object triggers the deletion of the PV object as well^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. Crucially, this action also removes the backend storage resources associated with the volume, such as a cloud disk (e.g., AWS EBS, GCE PD) or file system^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
Related Concepts¶
- [[PersistentVolume]]
- [[PersistentVolumeClaim]]
- StorageClass