This concept is vastly different than the idea of containers being fast and lightweight and easy to deploy anywhere needed at a moments notice. It’s for this reason that persistent state was purposefully left out of container specs, which opted instead for storage plugins; shifting the responsibility of managing persistent state to another party(container不带storage,而以plugins的方式来进行补充)
There are two key features of an application that require persistent state:
- the need to persist data beyondapplication outages and restarts
- and the need to manage application state acrossthe same outages and restarts.
Kubernetes Persistent Volumesand Persistent Volume Claimsprovide a way to abstract the details of how storage is provisioned from how it is consumed.
The .spec.storageClassName can be used to classify the PV as a certain class of storage, which can be leveraged by PVCs to specify a specific class of storage to claim.
1 | apiVersion: v1 |