Volumes

Describes Kubernetes volumes.

In Kubernetes, a volume is storage that persists across the containers within a pod for the lifespan of the pod itself. When a container within the pod is restarted, the data in the Kubernetes volume is preserved. Kubernetes volumes can be shared across containers within the pod, providing a file store that different containers can access locally.

Kubernetes provides various volume types that define how the data is stored and how it's persisted, which are described in detail in the upstream Kubernetes documentation.

The lifetime of a Kubernetes volume typically matches the lifetime of the pod, and data in a volume persists while the pod using that volume exists. Containers in the pod can be restarted and the data remains intact. However, if the pod is destroyed, the data is usually destroyed with it.

For situations in which the volume data must outlive the pod, Kubernetes introduces the concepts of the PersistentVolume and the PersistentVolumeClaim.

PersistentVolumes are similar to Volumes except that they exist independently of a pod. They define how to access a storage resource type, such as NFS, or iSCSI. Configure a PersistentVolumeClaim to use the resources available in a PersistentVolume. The PersistentVolumeClaim specifies the quota and access modes to be applied to the resource for a consumer. Use the PersistentVolumeClaim to gain access to these resources with the appropriate access modes and size restrictions applied.