PersistentVolumes represent both administrator-created and automatically provisioned storage. They contain data about the underlying storage medium, e.g. a disk or network share. The lifecycle of a PV is independent from a pod's, providing a basis for storage in stateful applications.
Pods make PersistentVolumeClaims for PVs, which are attached to pods via the host node's Kubelet, which maps it into the pod via a bind mount.
apiVersion: v1 kind: PersistentVolume metadata: name: my-pv spec: capacity: storage: 42Gi accessModes: - ReadWriteMany nfs: server: 10.100.118.247 path: /export
Existing volumes can be imported mounted into pods, though their lifecycles won't be managed by the cluster:
cephfsmounts existing CephFS volumes.
fcmounts fibre channel volumes.
glusterfsallow replicated, multi-writer access to a volume.
iscsimounts existing iSCSI volumes.
nfsmounts an external Network File System share.
Useful for testing, or for configurations in which the pod needs to be able to manipulate host configuration:
emptyDiris useful for storing transient data, and its lifetime is tied to the pod.
hostPathis Node-specific. Note the type field, which allows sharing sockets.
Cloud-specific volume types may be available based on the environment in which the cluster is running:
awsElasticBlockStorefor EBS volumes
azureDiskfor Azure Disks.
azureFilesfor Azure Files shares.
gcePersistentDiskfor GCP persistent disks (Private).
flexVolume is a pre-CSI mechanism for extension.