Skip to main content
XenonStack

DevOps

XenonStack Blog Kubernetes Persistent Storage: Volumes, CSI and Classes

and | Published | Updated

Kubernetes Persistent Storage: Volumes, CSI and Classes
15:40

Key takeaway

  • Kubernetes persistent storage: PVs, PVCs, StorageClasses and CSI drivers, which in-tree plugins were removed, and how to choose block, file or object.

Persistent storage in Kubernetes means a volume that outlives the pod that uses it. You request it with a PersistentVolumeClaim, a StorageClass tells the cluster how to provision it, and a CSI (Container Storage Interface) driver does the actual work against your block, file or object backend. Container storage is ephemeral, so without this chain a restarted database pod starts empty.

The main change since this guide was first written is that the old built-in storage plugins are gone. According to the Kubernetes persistent volumes documentation, the cephfs, glusterfs and rbd types are no longer available, and the AWS EBS and Azure Disk in-tree drivers were removed in v1.27. This guide shows what to use instead, how to choose between block, file and object storage, and how to run storage classes safely. For the wider picture of stateful workloads, see our guide to stateful and stateless applications.

What is persistent storage in Kubernetes?

Kubernetes separates storage into three objects. A PersistentVolume (PV) is a piece of storage in the cluster, created by an administrator or dynamically provisioned. A PersistentVolumeClaim (PVC) is a request for storage by a user, with a size and access mode. A StorageClass describes a class of storage and the provisioner that creates it. The persistent volumes documentation states that this split lets a workload ask for storage without knowing where it comes from.

Access modes decide how a volume can be shared. The same page defines them as follows:

Access modeMeaning (per Kubernetes docs)
ReadWriteOnce (RWO)Mounted read-write by a single node. Several pods on that node can still use it.
ReadOnlyMany (ROX)Mounted read-only by many nodes.
ReadWriteMany (RWX)Mounted read-write by many nodes.
ReadWriteOncePod (RWOP)Mounted read-write by a single pod across the whole cluster. Stable since Kubernetes v1.29.

Choose RWOP when exactly one pod must ever write to a claim, for example a single-writer database. Choose RWX only when your application is built for shared writes and your backend supports it.

Which storage type fits: block, file or object?

TypeHow data is storedBest fitTrade-off
BlockFixed-size blocks addressed by locationDatabases and single-writer stateful servicesUsually attached to one node at a time
FileFiles and directories in a shared file system (for example NFS or CephFS)Content shared by many podsShared writes need an application that copes with them
ObjectObjects addressed by ID, accessed over an API (for example S3)Backups, artefacts, data lakesNot mounted as a normal disk, and latency is higher than block

Object stores such as MinIO sit beside Kubernetes volumes rather than behind a PVC. Our MinIO architecture guide covers that pattern, and the RAID storage guide covers disk redundancy underneath block storage.

Which persistent storage option should you choose?

Every option below is consumed through a CSI driver. Driver names and access modes are taken from the Kubernetes CSI driver list, which notes that its table has not been validated by Kubernetes SIG-Storage, so confirm details on each vendor page.

OptionCSI driverType and access (per CSI list)When it fits
Amazon EBSebs.csi.aws.comBlock, single pod read-writeWorkloads on AWS or Amazon EKS that need block volumes
Azure Diskdisk.csi.azure.comBlock, single pod read-writeWorkloads on Azure or AKS
Google Compute Engine persistent diskpd.csi.storage.gke.ioBlock, single pod read-writeWorkloads on Google Cloud or GKE
Ceph RBDrbd.csi.ceph.comBlock, single pod read-writeOn-premises or hybrid block storage, usually run through Rook
CephFScephfs.csi.ceph.comFile, many pods read-writeShared file storage on an existing Ceph cluster
NFSnfs.csi.k8s.ioFile, many pods read-writeSimple shared storage where you already run an NFS server
OpenEBSSee the OpenEBS docsLocal volumes (single node) or replicated volumesClusters that turn node-attached disks into Kubernetes volumes

Ceph and Rook. Rook describes itself as an open source cloud-native storage orchestrator for Ceph, hosted by the CNCF as a graduated project, and Ceph offers file, block and object storage. The Ceph documentation says Ceph block images are provisioned for Kubernetes by Ceph-CSI, and that older hand-edited manifests are superseded by the Ceph-CSI-Operator and Helm charts. Our Kubernetes operators guide explains why operators suit this kind of storage.

OpenEBS. According to its documentation, OpenEBS turns any storage available to Kubernetes worker nodes into local or replicated persistent volumes. Local volumes are accessible only from a single node, and replicated volumes copy data across nodes.

GlusterFS. Kubernetes no longer includes the glusterfs volume type. Check the project page for its current maintenance status before choosing it for a new design, and prefer CephFS or NFS for shared file storage.

What changed: which in-tree plugins are gone?

Kubernetes moved storage plugins out of its core code into CSI drivers. Existing claims can keep working through CSI migration only if the matching CSI driver is installed, because the Kubernetes docs say the core does not install it for you.

Two columns mapping removed Kubernetes in-tree volume plugins to their CSI drivers: EBS, Azure Disk, GCE persistent disk, CephFS and Ceph RBD
Old volume typeStatus per Kubernetes docsUse instead
awsElasticBlockStoreIn-tree driver deprecated in v1.19 and removed in v1.27 (StorageClass page)Amazon EBS CSI driver
azureDiskDeprecated in v1.19 and removed in v1.27 (StorageClass page)Azure Disk CSI driver
gcePersistentDiskDeprecated in v1.17 and removed in v1.28 (volumes page)Google Compute Engine persistent disk CSI driver
cephfsRemoved in v1.31 (Kubernetes v1.31 upcoming changes post)CephFS CSI driver
rbdListed as no longer available (persistent volumes page); v1.31 removal announcedCeph RBD CSI driver
glusterfsListed as no longer available (persistent volumes page)CephFS, NFS or a vendor CSI driver
nfsStill supported as a volume typeNFS CSI driver if you want dynamic provisioning

If you upgrade a cluster that still uses the removed types, install the CSI driver first and re-deploy workloads that reference the old plugin, as the Kubernetes v1.31 notes advise for CephFS and Ceph RBD.

How do StorageClasses work in Kubernetes?

A StorageClass names a provisioner and its parameters. The StorageClass documentation says each class contains provisioner, parameters and reclaimPolicy, and that the provisioner field must be specified. Dynamically created volumes use the class reclaim policy, which defaults to Delete if you do not set one. Use Retain for data you cannot afford to lose by accident.

  • volumeBindingMode. Immediate provisions as soon as the claim is created. WaitForFirstConsumer delays binding until a pod uses the claim, so the volume is created in a topology the pod can reach. This avoids unschedulable pods on zone-bound disks.
  • allowVolumeExpansion. Set to true to let supported volumes grow. The docs state you can grow a volume but not shrink it.
  • Default class. The annotation storageclass.kubernetes.io/is-default-class: "true" marks the default. If more than one class carries it, a claim with no class uses the most recently created default.
  • Local volumes. The docs say local volumes do not support dynamic provisioning, but you should still create a StorageClass to delay binding until the pod is scheduled.
  • NFS. NFS has no internal provisioner, so use an external one or the NFS CSI driver.

A current StorageClass for the Amazon EBS CSI driver looks like this. Check the parameter names for your driver version in its own documentation.

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-gp3
provisioner: ebs.csi.aws.com
parameters:
  type: gp3
reclaimPolicy: Retain
allowVolumeExpansion: true
volumeBindingMode: WaitForFirstConsumer

A claim that uses it, and a pod that mounts the claim:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: app-data
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ebs-gp3
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: app
spec:
  containers:
    - name: app
      image: registry.example.com/app:1.0
      volumeMounts:
        - name: data
          mountPath: /var/lib/app
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: app-data

For production stateful services, run databases through a StatefulSet or an operator rather than a bare pod, so each replica gets its own claim.

How do you deploy each storage backend?

  • Amazon EBS. The EBS volume and the instance must be in the same Availability Zone, per the AWS documentation. On Amazon EKS, AWS recommends installing the EBS CSI driver as an EKS add-on, and EKS Auto Mode uses the ebs.csi.eks.amazonaws.com provisioner. EBS volumes cannot be mounted to Fargate pods.
  • Azure Disk. According to Microsoft Learn, each AKS cluster ships built-in Azure Disk storage classes backed by disk.csi.azure.com, including default (Standard SSD) and managed-csi-premium (Premium SSD).
  • Google Cloud. The GKE documentation names the driver pd.csi.storage.gke.io and says it is always enabled in Autopilot clusters, while Standard clusters need it enabled.
  • Ceph. Deploy Ceph-CSI through its operator or Helm chart, or run the whole cluster with Rook. Never paste Ceph keys into manifests or blog snippets; keep them in Kubernetes Secrets.
  • NFS. You need your own NFS server with the share exported. The Kubernetes docs add that you cannot set NFS mount options in a pod spec, but you can through a PersistentVolume.
  • OpenEBS. Follow the install steps in the OpenEBS documentation for your chosen volume type, and pin the chart version you tested.

How do you manage StorageClasses day to day?

  • Create. Write the class as YAML and apply it with kubectl apply -f. Use one class per service level, for example standard, fast and retained.
  • Change. Edit the manifest and re-apply it, then test on a new claim before relying on it.
  • Delete. kubectl delete storageclass <name> removes the class. Check which claims reference it first.
  • Review. List classes with kubectl get storageclass and confirm exactly one default.

What should enterprise teams govern?

Storage choices carry security, cost and recovery decisions. Treat them as policy, not as defaults.

AreaWhat to decideWhy it matters
Data protectionReclaim policy, snapshots and backup ownershipDelete removes the backing storage asset, per the Kubernetes docs
AccessAccess modes and who can create claimsRWX and shared file stores widen the blast radius of a bad write
TopologyWaitForFirstConsumer and zone placementZone-bound disks can leave pods unschedulable
LifecycleDriver versions and Kubernetes upgradesRemoved in-tree plugins break claims without a CSI driver
CostVolume size, class and expansion policyVolumes can grow but not shrink

AI agents and retrieval stores add stateful workloads, such as vector databases and agent memory, which need the same discipline. ElixirData Context OS keeps governed context, versioned policy and decision traces in one decision layer above AI agents, and ElixirClaw is an agentic OS platform to build, orchestrate and govern AI agents and automation workflows while keeping humans in control. Both depend on storage that is backed up, access controlled and recoverable.

When should you not use a given option?

  • Do not put a single-writer database on an RWX file share only because it is available.
  • Do not build new designs on GlusterFS or any removed in-tree plugin.
  • Do not use hostPath outside single-node testing; the Kubernetes docs say it will not work in a multi-node cluster.
  • Do not skip restore tests; a retained volume is not a backup.

What is a sensible adoption sequence?

  • Inventory every PV, claim and class, and note which use removed in-tree plugins.
  • Install the CSI driver for each backend and confirm the version supports your Kubernetes release.
  • Create a small set of classes with WaitForFirstConsumer and an explicit reclaim policy.
  • Move stateful workloads to StatefulSets or operators, then test snapshot and restore.
  • Review classes, defaults and drivers at every Kubernetes upgrade.

Related reading: Kubernetes architecture components, Helm for Kubernetes and Kubernetes operators.

To map one storage or data-protection decision your AI agents depend on, and the context and policy behind it, book a Context Workshop. See what happens in the workshop.

Frequently asked questions

What is persistent storage in Kubernetes?

It is storage that outlives a pod. You request it with a PersistentVolumeClaim, a StorageClass and a CSI driver provision it, and the data stays when the pod restarts.

Which in-tree storage plugins have been removed?

According to the Kubernetes documentation, awsElasticBlockStore and azureDisk were removed in v1.27, gcePersistentDisk in v1.28, and cephfs, glusterfs and rbd are listed as no longer available. Use the matching CSI drivers.

What does WaitForFirstConsumer do?

It delays volume binding and provisioning until a pod that uses the claim is scheduled, so the volume is created in a location the pod can reach. Immediate binds as soon as the claim is created.

What is the difference between RWO and RWOP?

ReadWriteOnce allows one node to mount the volume read-write, and several pods on that node can use it. ReadWriteOncePod, stable since Kubernetes v1.29, allows only one pod in the whole cluster.

Which storage should I use for shared files?

CephFS and NFS are listed in the Kubernetes CSI driver list as supporting read-write access from multiple pods. Confirm performance and support on each vendor page before choosing.

Follow XenonStack on LinkedIn: XenonStack on LinkedIn for new guides on agentic AI, data and platform engineering.

Table of Contents

navdeep-singh-gill

Navdeep Singh Gill

Global CEO and Founder of XenonStack

LinkedIn profile

Navdeep Singh Gill is serving as Chief Executive Officer and Product Architect at XenonStack. He holds expertise in building SaaS Platform for Decentralised Big Data management and Governance, AI Marketplace for Operationalising and Scaling. His incredible experience in AI Technologies and Big Data Engineering thrills him to write about different use cases and its approach to solutions.

Get the latest articles in your inbox

Subscribe Now

Interested in solving your challenges with the XenonStack team?
Get Started

Tell us about you and your priorities so we can prepare the right conversation. It takes about 2 minutes.

Please Select your Industry
Banking
Fintech
Payment Providers
Wealth Management
Discrete Manufacturing
Semiconductor
Machinery Manufacturing / Automation
Appliances / Electrical / Electronics
Elevator Manufacturing
Defense & Space Manufacturing
Computers & Electronics / Industrial Machinery
Motor Vehicle Manufacturing
Food and Beverages
Distillery & Wines
Beverages
Shipping
Logistics
Mobility (EV / Public Transport)
Energy & Utilities
Hospitality
Digital Gaming Platforms
SportsTech with AI
Public Safety - Explosives
Public Safety - Firefighting
Public Safety - Surveillance
Public Safety - Others
Media Platforms
City Operations
Airlines & Aviation
Defense Warfare & Drones
Robotics Engineering
Drones Manufacturing
AI Labs for Colleges
AI MSP / Quantum / AGI Institutes
Retail Apparel and Fashion

Continue