⎈ k8s knowledge compiler

Persistent Volumes [page]deterministic

conceptsstorage

This document describes _persistent volumes_ in Kubernetes. Familiarity with [volumes](/docs/concepts/storage/volumes/), [StorageClasses](/docs/concepts/storage/storage-classes/) and [VolumeAttributesClasses](/docs/concepts/storage/volume-attributes-classes/) is suggested.

## Introduction

Managing storage is a distinct problem from managing compute instances. The PersistentVolume subsystem provides an API for users and administrators that abstracts details of how storage is provided from how it is consumed. To do this, we introduce two new API resources: PersistentVolume and PersistentVolumeClaim.

A _PersistentVolume_ (PV) is a piece of storage in the cluster that has been provisioned by an administrator or dynamically provisioned using [Storage Classes](/docs/concepts/storage/storage-classes/). It is a resource in the cluster just like a node is a cluster resource. PVs are volume plugins like Volumes, but have a lifecycle independent of any individual Pod that uses the PV. This API object captures the details of the implementation of the storage, be that NFS, iSCSI, or a cloud-provider-specific storage system.

A _PersistentVolumeClaim_ (PVC) is a request for storage by a user. It is similar to a Pod. Pods consume node resources and PVCs consume PV resources. Pods can request specific levels of resources (CPU and Memory). Claims can request specific size and access modes (e.g., they can be mounted ReadWriteOnce, ReadOnlyMany, ReadWriteMany, or ReadWriteOncePod, see [AccessModes](#access-modes)).

While PersistentVolumeClaims allow a user to consume abstract storage resources, it is common that users need PersistentVolumes with varying properties, such as performance, for different problems. Cluster administrators need to be able to offer a variety of PersistentVolumes that differ in more ways than size and access modes, without exposing users to the details of how those volumes are implemented. For these needs, there is the _StorageClass_ resource.

See the [detailed walkthrough with working examples](/docs/tutorials/configuration/configure-persistent-volume-storage).

## Lifecycle of a volume and claim

PVs are resources in the cluster. PVCs are requests for those resources and also act as claim checks to the resource. The interaction between PVs and PVCs follows this lifecycle:

### Provisioning

There are two ways PVs may be provisioned: statically or dynamically.

#### Static

A cluster administrator creates a number of PVs. They carry the details of the real storage, which is available for use by cluster users. They exist in the Kubernetes API and are available for consumption.

#### Dynamic

When none of the static PVs the administrator created match a user's PersistentVolumeClaim, the cluster may try to dynamically provision a volume specially for the PVC. This provisioning is based on StorageClasses: the PVC must request a [storage class](/docs/concepts/storage/storage-classes/) and the administrator must have created and configured that class for dynamic provisioning to occur. Claims that request the class `""` effectively disable dynamic provisioning for themselves.

To enable dynamic storage provisioning based on storage class, the cluster administrator needs to enable the `DefaultStorageClass` [admission controller](/docs/reference/access-authn-authz/admission-controllers/#defaultstorageclass) on the API server. This can be done, for example, by ensuring that `DefaultStorageClass` is among the comma-delimited, ordered list of values for the `--enable-admission-plugins` flag of the API server component. For more information on API server command-line flags, check [kube-apiserver](/docs/reference/command-line-tools-reference/kube-apiserver/) documentation.

### Binding

A user creates, or in the case of dynamic provisioning, has already created, a PersistentVolumeClaim with a specific amount of storage requested and with certain access modes. A control loop in the control plane watches for new PVCs, finds a m …(trimmed)

Sources

concepts/storage/persistent-volumes.md · docPersistent Volumes

Related (25)

references Container Storage Interface (CSI)csi conf=1
references Quantityquantity conf=1
part_of Introductiondescribes conf=1
part_of Lifecycle of a volume and claimdescribes conf=1
part_of Types of Persistent Volumesdescribes conf=1
part_of Persistent Volumesdescribes conf=1
part_of PersistentVolumeClaimsdescribes conf=1
part_of Claims As Volumesdescribes conf=1
part_of Raw Block Volume Supportdescribes conf=1
part_of Volume Cloningdescribes conf=1
part_of Volume populators and data sourcesdescribes conf=1
part_of Writing Portable Configurationdescribes conf=1
part_of {{% heading "whatsnext" %}}describes conf=1
part_of Provisioningdescribes conf=1
part_of Bindingdescribes conf=1
part_of Usingdescribes conf=1
part_of Storage Object in Use Protectiondescribes conf=1
part_of Reclaimingdescribes conf=1
part_of Reserving a PersistentVolumedescribes conf=1
part_of Expanding Persistent Volumes Claimsdescribes conf=1
part_of Capacitydescribes conf=1
part_of Volume Modedescribes conf=1
part_of Access Modesdescribes conf=1

← all Docs