Persistent Volume

A PersistentVolume (PV) represents the mapping relationship with backend storage volumes in a Kubernetes cluster, functioning as a Kubernetes API resource. It is a cluster resource created and configured uniformly by administrators, responsible for abstracting the actual storage resources and forming the storage infrastructure of the cluster.

PersistentVolumes possess a lifecycle independent of Pods, enabling the persistent storage of Pod data.

Administrators may manually create static PersistentVolumes or generate dynamic PersistentVolumes based on storage classes. If developers need to obtain storage resources for applications, they can request them via PersistentVolumeClaims (PVC), which match and bind to suitable PersistentVolumes.

Dynamic Persistent Volumes vs. Static Persistent Volumes

The platform supports management of two types of PersistentVolumes by administrators, namely dynamic and static Persistent Volumes.

  • Dynamic Persistent Volumes: Implemented based on storage classes. Storage classes are created by administrators and define a Kubernetes resource that describes the category of storage resources. Once a developer creates a PersistentVolumeClaim associated with a storage class, the platform will dynamically create a suitable PersistentVolume according to the parameters configured in the PersistentVolumeClaim and storage class, binding it to the PersistentVolumeClaim for dynamic allocation of storage resources.

  • Static Persistent Volumes: Persistent Volumes created manually by the administrator. Currently, it supports the creation of HostPath or NFS shared storage type static Persistent Volumes. When developers create a PersistentVolumeClaim without using a storage class, the platform will match and bind a suitable static PersistentVolume according to the parameters configured in the PersistentVolumeClaim.

    • HostPath: Uses a file directory on the node host (local storage is not supported) as backend storage, such as: /etc/kubernetes. It generally applies only to testing scenarios within a single compute node cluster.

    • NFS Shared Storage: Refers to the Network File System, a common type of backend storage for Persistent Volumes. Users and programs can access files on remote systems as if they were local files.

Lifecycle of Persistent Volumes

  1. Provisioning: Administrators manually create static Persistent Volumes. After creation, the Persistent Volume enters an Available state; alternatively, the platform creates suitable Persistent Volumes dynamically based on PersistentVolumeClaims associated with storage classes.

  2. Binding: Once a static Persistent Volume is matched and bound to a PersistentVolumeClaim, it enters a Bound state; dynamic Persistent Volumes are created dynamically based on requests matching PersistentVolumeClaims and also enter a Bound state once created successfully.

  3. Using: Developers associate PersistentVolumeClaims with container instances of compute components, utilizing the backend storage resources mapped by the Persistent Volumes.

  4. Releasing: After developers delete the PersistentVolumeClaim, the Persistent Volume is released.

  5. Reclaiming: Once the Persistent Volume is released, reclamation operations are performed on it according to the reclamation policy parameters of the Persistent Volume or storage class.