PV lifecycle and status states¶
In Kubernetes, a PersistentVolume (PV) is a storage resource in the cluster with a lifecycle independent of any individual Pod that utilizes it^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. This separation ensures that data persists even as Pods are terminated or scaled^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
PV lifecycle states¶
A PV exists in one of several phases, indicating its availability and binding status^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]:
- Available: The volume is a free resource within the cluster and has not yet been bound to a claim^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- Bound: The PersistentVolume has been successfully bound to a specific PersistentVolumeClaim (PVC)^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- Released: The PersistentVolumeClaim that was bound to the volume has been deleted, but the volume has not yet been reclaimed by the cluster^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- Failed: The automatic reclamation process for the volume has failed^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
Reclaim Policies¶
When a PV is released, its data is handled according to a reclaim policy configured on the volume^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- Retain: This is a manual reclamation policy. The volume remains in the
Releasedstate with data intact, requiring an administrator to manually handle the data before the volume is made available again^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. - Delete: This policy means that when the PersistentVolume is deleted, both the PV object and the associated underlying storage asset (e.g., the disk or file share) are deleted^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- Recycle: This policy (now deprecated) involved executing a command like
rm -rf /thevolume/*to scrub the data^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. The recommended modern approach is to use dynamic provisioning^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].