πŸ“šBook Signing at KubeCon EU 2026Meet us at Booking.com HQ (Mon 18:30-21:00) & vCluster booth #521 (Tue 24 Mar, 12:30-1:30pm) β€” free book giveaway!RSVP Booking.com Event
Storage beginner ⏱ 15 minutes K8s 1.28+

Persistent Volume Expansion Kubernetes

Expand PersistentVolumeClaims online without downtime. allowVolumeExpansion, filesystem resize, StatefulSet PVC expansion.

By Luca Berton β€’ β€’ πŸ“– 5 min read

πŸ’‘ Quick Answer: Set allowVolumeExpansion: true on your StorageClass, then kubectl edit pvc <name> and increase spec.resources.requests.storage. The volume and filesystem expand automatically (online for most CSI drivers).

The Problem

Applications grow β€” databases fill up, log volumes expand, ML datasets accumulate. You need to increase PVC size without downtime, pod restarts, or data migration. Kubernetes supports online volume expansion, but it requires proper StorageClass configuration.

The Solution

Enable Volume Expansion

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

Expand a PVC

# Check current size
kubectl get pvc data-volume -o jsonpath='{.spec.resources.requests.storage}'
# 10Gi

# Expand to 50Gi
kubectl patch pvc data-volume -p '{"spec":{"resources":{"requests":{"storage":"50Gi"}}}}'

# Monitor expansion
kubectl get pvc data-volume -o jsonpath='{.status.conditions[*].type}'
# FileSystemResizePending β†’ (empty when complete)

# Verify new size
kubectl exec my-pod -- df -h /data
# /dev/nvme1n1  50G  8.2G  42G  17% /data

StatefulSet PVC Expansion

# StatefulSet PVCs are named: <volumeClaimTemplate-name>-<pod-name>
# Expand each one individually
for i in 0 1 2; do
  kubectl patch pvc data-db-$i -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'
done

⚠️ You cannot change volumeClaimTemplates in a StatefulSet. Expand existing PVCs individually.

graph LR
    EDIT[kubectl patch pvc<br/>50Gi β†’ 100Gi] --> CSI[CSI Driver<br/>Expand block device]
    CSI --> FS[Filesystem Resize<br/>ext4/xfs online resize]
    FS --> POD[Pod sees new size<br/>df -h shows 100Gi]

Common Issues

PVC stuck in FileSystemResizePending

Some CSI drivers require pod restart to trigger filesystem resize. Delete the pod β€” StatefulSet recreates it, and the filesystem expands on mount.

β€œstorageclass does not allow volume expansion”

The StorageClass has allowVolumeExpansion: false (or unset). You can’t change it retroactively for existing PVCs. Create a new StorageClass with expansion enabled.

Best Practices

  • Always set allowVolumeExpansion: true on production StorageClasses
  • You can only increase PVC size β€” shrinking is not supported
  • Expand during low-traffic periods β€” filesystem resize may briefly increase I/O latency
  • Monitor PVC usage with Prometheus β€” alert at 80% capacity to expand proactively
  • Test expansion in staging before production β€” verify your CSI driver supports online resize

Key Takeaways

  • PVC expansion requires allowVolumeExpansion: true on the StorageClass
  • kubectl patch pvc to increase storage β€” CSI driver + filesystem resize handles the rest
  • StatefulSet PVCs must be expanded individually (can’t change volumeClaimTemplates)
  • Online expansion works with most CSI drivers (EBS, GCE PD, Azure Disk, Ceph)
  • You can only grow PVCs β€” shrinking is never supported
#pvc #expansion #storage #statefulset
Luca Berton
Written by Luca Berton

Principal Solutions Architect specializing in Kubernetes, AI/GPU infrastructure, and cloud-native platforms. Author of Kubernetes Recipes and creator of CopyPasteLearn courses.

Kubernetes Recipes book cover

Want More Kubernetes Recipes?

This recipe is from Kubernetes Recipes, our 750-page practical guide with hundreds of production-ready patterns.

Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens