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
    name: my-pv
        storage: 42Gi
      - ReadWriteMany
        path: /export

Volume types

  • configMap can be used to mount keys of ConfigMaps.
  • secret can be used to mount keys of Secrets.

Existing volumes can be imported mounted into pods, though their lifecycles won't be managed by the cluster:

  • cephfs mounts existing CephFS volumes.
  • fc mounts fibre channel volumes.
  • glusterfs allow replicated, multi-writer access to a volume.
  • iscsi mounts existing iSCSI volumes.
  • nfs mounts an external Network File System share.

Useful for testing, or for configurations in which the pod needs to be able to manipulate host configuration:

  • emptyDir is useful for storing transient data, and its lifetime is tied to the pod.
  • hostPath is 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:

flexVolume is a pre-CSI mechanism for extension.