A persistent volume provides durable Kubernetes storage that survives an individual container’s lifecycle. Cloud-managed clusters attach the volume to a cluster node for workloads that need data to persist. section 8.1.3 section 8.4.1
Request and use a persistent volume through a PersistentVolumeClaim (PVC):
- Set accessModes, such as ReadWriteOnce; supported modes depend on the cloud provider. section 8.4.1
- Request capacity with resources.requests.storage, such as 10Gi for 10 gigabytes. section 8.4.1
- Choose a storageClassName, including a class that retains the drive after the PVC is deleted. section 8.4.1
- Reference the PVC from a Deployment, then mount it into the container filesystem. section 8.4.1
Mount storage in an nginx Deployment
A PVC can request 10Gi with ReadWriteOnce and a retained storage class. An nginx Deployment then claims it and mounts the volume at /usr/share/nginx/html. Apply both resources with kubectl apply -f deploy-pvc/ and inspect the claim with kubectl describe pvc first-pvc. section 8.4.1
Listing 8.14 PersistentVolumeClaim resource
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: first-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: linode-block-storage-retain
Use the manifest to inspect the PVC fields that request and control persistent storage. section 8.4.1
Listing 8.15 Deployment resource with a PVC
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 1
...
template:
...
spec:
...
containers:
- name: nginx
...
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: first-pv-storage
volumes:
- name: first-pv-storage
persistentVolumeClaim:
claimName: first-pvc
Use the Deployment manifest to trace the PVC from the pod specification to its container mount path. section 8.4.1






