Data must outlive the Pod
Container files
A container's filesystem is not suitable for long-lived application data. Replacing the container can lose those files. emptyDir survives a container restart within the same Pod, but is deleted with the Pod.
PV and PVC
PersistentVolume describes available persistent storage, while PersistentVolumeClaim describes an application's request. Binding depends on capacity, storage class, and access mode. CSI provides integration with a specific storage system.
Suitable capacity
Our cluster has a compatible 16 Gi volume, and the dataset occupies 10 Gi. A 32 Gi request will not find a suitable volume. An 8 Gi request is too small for the dataset. Adding Pods alone cannot fix these conditions.
What a PVC does not promise
A PVC alone does not create backups, replication, or safe concurrent writes. A StatefulSet provides stable identities and volume management, but data properties depend on the application and storage.
Task
The application has 1000 records totaling 10 Gi. At 21 s, the container is replaced. Bind a PVC to the 16 Gi training volume and preserve the original data.
There is one compatible 16 Gi volume and a 10 Gi dataset. A request above 16 Gi remains Pending; one below 10 Gi cannot fit the dataset. With a suitable PVC, the data is mounted into the replacement Pod. Restart is instantaneous: we examine data lifetime, not availability, replication, or backups.
- Add a PVC.
- Choose compatible storage with sufficient capacity.
- Check the original records after replacing the Pod.