Cloud Native 5 min read

How to Expand Kubernetes PVCs Without Downtime: Step‑by‑Step Guide

This guide explains how to safely increase the capacity of a Kubernetes PersistentVolumeClaim without stopping services, covering prerequisites, parameter checks, storage class configuration, timing considerations, and practical commands to perform the expansion.

Linux Ops Smart Journey
Linux Ops Smart Journey
Linux Ops Smart Journey
How to Expand Kubernetes PVCs Without Downtime: Step‑by‑Step Guide

With the rise of cloud computing and containerization, Kubernetes has become the key platform for deploying and managing applications. When data grows, expanding a PersistentVolumeClaim (PVC) without affecting online services is a challenge.

Prerequisites

Kubernetes version >= 1.11 (apiserver enabled by default).

Underlying storage CSI support:

NFS >= 3.0.0

rbd/cephfs >= 2.0.0

Confirm storageClass configuration parameters.

Confirm PVC expansion parameters

Check apiserver parameters:

<code># 1.11 <= kubernetes version <= 1.24
$ ps -ef | grep [a]piserver | egrep 'disable-admission-plugins|feature-gates'

# kubernetes <= 1.25
$ ps -ef | grep [a]piserver | egrep 'disable-admission-plugins'
</code>

Tip: If there is no output, the PVC expansion conditions are met; otherwise verify that PersistentVolumeClaimResize is in disable-admission-plugins and ExpandPersistentVolumes=false is in feature-gates .

Check storageClass configuration:

<code>$ kubectl get storageclass
NAME               PROVISIONER               RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
ceph-fs-storage   cephfs.csi.ceph.com       Retain          Immediate           true                  130d
ceph-rbd-storage  rbd.csi.ceph.com          Retain          Immediate           true                  131d
local-storage     kubernetes.io/no-provisioner Delete       WaitForFirstConsumer false               131d
nfs-storage        k8s/nfs-provisioner        Delete          Immediate           true                  45d

# Ensure ALLOWVOLUMEEXPANSION is true
$ kubectl patch storageclass ceph-rbd-storage -p '{"allowVolumeExpansion": true}'
</code>

Trigger PVC expansion timing

The volume can be resized only when the filesystem is XFS, Ext3 or Ext4. The resize occurs when a Pod uses the PVC in ReadWrite mode and the underlying filesystem supports online expansion. The resize is completed when the Pod starts.

Practical PVC expansion

1. Edit the PVC to request a larger size:

<code>$ kubectl -n kube-system edit pvc prometheus
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 16Gi # new size
  storageClassName: ceph-rbd-storage
  volumeMode: Filesystem
  volumeName: pvc-6ff4a3a6-cd81-4fcc-9dd3-c47a7fb7d3ba
</code>

2. Verify the PVC:

<code>$ kubectl -n kube-system exec -it prometheus-6dc4bcd4b7-k4575 -c prometheus-server -- df -Th /data/
Filesystem   Type   Size   Used   Available Use% Mounted on
/dev/rbd2    ext4   15.6G  6.6G   9.0G      42% /data
</code>

Tip: If the PVC shows FileSystemResizePending , the resize will be triggered automatically when the Pod restarts or after a few minutes if the Pod is running and performing I/O.

Conclusion

By following these steps, you can safely increase PVC capacity without stopping services, improving operational efficiency and user experience while ensuring continuous business stability.

cloud nativeKubernetesDevOpsPVCStorage Expansion
Linux Ops Smart Journey
Written by

Linux Ops Smart Journey

The operations journey never stops—pursuing excellence endlessly.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.