Ephemeral Storage
Use volumes like emptyDir, configMap, and secret when data only needs to live with the Pod lifecycle or deliver runtime data into a container.
Interactive summary of ephemeral and persistent storage, PV and PVC binding, StorageClasses, CSI, snapshots, and shared-storage design choices.
Use volumes like emptyDir, configMap, and secret when data only needs to live with the Pod lifecycle or deliver runtime data into a container.
Use PersistentVolume and PersistentVolumeClaim when data must survive Pod deletion, controller rollouts, and rescheduling events.
StorageClass describes how storage should be created and bound. CSI drivers make that policy real on cloud or on-premises backends.
Reclaim policy, snapshots, backup, performance, security, and capacity planning matter just as much as the initial volume declaration.
Decide if the app needs scratch space, durable state, or shared writable files across nodes.
Use direct Pod volumes for simple runtime needs or PV and PVC resources when the data must outlive the Pod.
ReadWriteOnce, ReadOnlyMany, and ReadWriteMany only work when the chosen backend truly supports them.
Kubernetes binds a PVC to a compatible PV or provisions one through a StorageClass and CSI driver.
Use reclaim policy, snapshots, and backup strategy so the storage design remains safe after day one.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: standard
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: app-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: app-data-snap
spec:
volumeSnapshotClassName: csi-snapclass
source:
persistentVolumeClaimName: app-data
| Component | Role | Main Question |
|---|---|---|
| Volume | Pod-level mount | What storage does this Pod use now? |
| PersistentVolume | Cluster storage resource | What storage supply exists? |
| PersistentVolumeClaim | Workload request | What storage does the app need? |
| StorageClass | Provisioning template | How should the volume be created and bound? |
| CSI Driver | Backend integration | Which platform implements the request? |
Use persistent storage for databases, queues, and any service whose value depends on durable data.
Use file-oriented backends such as NFS or CephFS when multiple Pods need coordinated file access.
Decide on reclaim, cleanup, backup, and snapshot strategy before the first application depends on the volume.