-
Notifications
You must be signed in to change notification settings - Fork 0
EN_K8s_Storage
somaz edited this page Mar 30, 2026
·
1 revision
7. Kubernetes Persistent Volumes (PV) and Persistent Volume Claims (PVC), StorageClass, and CSI (Container Storage Interface)
graph TD
PV("Persistent Volume (PV)")
PVC("Persistent Volume Claim (PVC)")
Pod("Pod")
Retain("Retain Policy")
Delete("Delete Policy")
Recycle("Recycle Policy")
Provisioning("Provisioning")
Binding("Binding")
Using("Using")
Releasing("Releasing")
Reclaiming("Reclaiming")
SC("Storage Class")
Dynamic("Dynamic Provisioning")
Static("Static Provisioning")
CSI("CSI-Driver")
Block("Block Storage")
File("File Storage")
Object("Object Storage")
PV -- "Bound by" --> PVC
PVC -- "Referenced by" --> Pod
PV -- "Retain" --> Retain
PV -- "Delete" --> Delete
PV -- "Recycle" --> Recycle
Provisioning -- "leads to" --> Binding
Binding -- "leads to" --> Using
Using -- "leads to" --> Releasing
Releasing -- "leads to" --> Reclaiming
SC -- "creates" --> PV
SC -- "Defines provisioning" --> Dynamic
SC -- "Defines provisioning" --> Static
CSI -- "Manages" --> Block
CSI -- "Manages" --> File
CSI -- "Manages" --> Object
PVC -- "Can specify" --> SC
PV -- "Managed by" --> CSI
-
Persistent Volumes (PV) are storage resources within a cluster, provisioned by an administrator or dynamically using a storage class.
-
PVs exist as cluster resources, similar to nodes, and can be claimed by users.
-
Key Features:
- Life Cycle Independent of Pod: PVs are independent of the life cycle of individual pods that use them.
- Storage Abstraction: Abstracts the specifics of storage provisioning and usage.
-
Supports Various Access Modes: Includes modes like
ReadWriteOnce, ReadOnlyMany, and ReadWriteMany.-
ReadWriteOnce: Mountable as read-write by a single node. -
ReadOnlyMany: Mountable as read-only by multiple nodes. -
ReadWriteMany: Mountable as read-write by multiple nodes.
-
-
PVCs are requests for storage made by users, similar to how pods use node resources.
-
Key Features:
- Storage Request: Users request specific sizes and access modes.
- Binding: Automatically binds to an appropriate PV in the cluster.
- Usage in Pods: Used as a volume within a pod, referenced by name.
-
persistentVolumeReclaimPolicy:
- This field in the PV specifies the action on the volume post-release from the claim.
- Policies:
- Retain: Default policy to keep the volume and preserve data after release.
- Delete: For dynamically provisioned PVs, deletes the volume from the underlying storage upon PVC deletion.
- Recycle: Not recommended for dynamic provisioning. Used to clear the volume data for new claims.
- Provisioning: PVs can be dynamically provisioned through storage classes or pre-provisioned manually.
- Binding: Users create PVCs requesting specific sizes and access modes, which then bind to available PVs.
- Using: Once bound, the PVC is used by pods, referencing and mounting the PV as a volume.
- Releasing: Users can delete the PVC after use. Depending on the reclaim policy, the PV either becomes available again or is deleted.
-
Reclaiming: With
Retainpolicy, PV remains in the cluster post-PVC deletion. WithDelete, both PV and related external storage assets are deleted.
StorageClass allows administrators to define different "classes" of storage.
- Key Aspects:
- Provisioning: Can be dynamic or static, defining how storage is allocated.
- Parameters: Various parameters depending on the storage provider.
- Binding: PVCs can specify a StorageClass. Only PVs of the same class can bind to a PVC.
CSI standardizes the exposure of block and file storage systems to workloads in COS like Kubernetes.
- Key Goal: Provide a consistent API for storage solutions, facilitating integration in cloud-native ecosystems.
CSI supports various volume types:
- Block Storage: Basic block-level storage, used mainly in performance-critical applications.
- File Storage: Shared or dedicated file access, often in shared storage systems.
- Object Storage: Stores each object separately, used mainly for unstructured data.
In addition to CSI volume types, pods can use other volume types:
- hostPath: Mounts a file/directory from the host node's filesystem into the pod.
- emptyDir: A temporary directory shared with the pod's lifespan.