StatefulSet volumeClaimTemplates: Resize Without Recreating StatefulSets make per-pod storage predictable. Then your database fills up, and you learn that the volumeClaimTemplates field is not the same thing as the PVCs already attached to your pods.

Resizing without recreating the StatefulSet means expanding each generated PersistentVolumeClaim in place. That works when the StorageClass and CSI driver support expansion. Editing the template alone does nothing for existing claims.

This guide walks through the workflow: confirm expansion support, back up, patch the right PVCs, monitor both Kubernetes and filesystem resize status, and avoid the mistakes that cost data or cause surprises at scale-up.

Key Takeaways

  • volumeClaimTemplates are blueprints; generated PVCs like data-app-0 are what you expand.
  • Expansion is one-way. Shrinking means migrating to a new volume.
  • StorageClass, CSI driver, quotas, filesystem, and replication decide whether the resize is online.
  • Never delete the StatefulSet or PVCs, and don't expect a manifest edit to resize volumes.

How to Resize StatefulSet PVCs Without Recreating the StatefulSet

Step 1: Identify the StatefulSet and every generated PVC

Each template produces one claim per pod, named <template>-<statefulset>-<ordinal>. A template called data in a StatefulSet named app yields data-app-0, data-app-1, and so on. Resizing one does not touch the others.

kubectl get sts app -n prod -o yaml
kubectl get pvc -n prod
kubectl describe pvc data-app-0 -n prod

Before changing anything, record for each PVC:

  • Current requested size and bound PV
  • StorageClass and access mode
  • Which pod it's attached to
  • The pod's role in the application (primary, replica, shard)

Step 2: Confirm that in-place expansion is supported

Check the StorageClass:

kubectl get storageclass <name> -o yaml

You need allowVolumeExpansion: true. The CSI driver must also support expansion for your volume type. Expansion and in-place filesystem growth have been stable since Kubernetes 1.24, but support still varies by driver, so check the driver and provider docs.

Then confirm the safety net:

  • A recent backup or snapshot you've verified can restore
  • Enough cloud quota and backend capacity
  • A plan to keep quorum or replication healthy while you expand several PVCs

Provider limits matter. AWS EBS, for example, allows up to four modifications in a rolling 24 hours, and the previous change must finish first. Google's Extreme Persistent Disk allows one resize per six hours.

Step 3: Patch the generated PVCs, not the StatefulSet template

Increase spec.resources.requests.storage on one PVC at a time:

kubectl patch pvc data-app-0 -n prod --type merge \
  -p '{"spec":{"resources":{"requests":{"storage":"200Gi"}}}}'

To cover the remaining ordinals, loop with explicit guardrails:

NS=prod; SIZE=200Gi
for i in 0 1 2; do
  kubectl patch pvc data-app-$i -n $NS --type merge \
    -p "{\"spec\":{\"resources\":{\"requests\":{\"storage\":\"$SIZE\"}}}}"
  # wait and verify before the next one
done

Generated StatefulSet PVC expansion workflow across pod ordinals

Don't run the loop blindly. Verify each claim before moving on, especially for databases.

Editing volumeClaimTemplates won't help. Kubernetes treats that field as immutable after creation, so the API rejects the change, and even where it didn't, existing claims wouldn't follow. New replicas created at scale-up still get the template's original size, so a later scale-out can produce pods with smaller disks.

Keep the desired size in your infrastructure repository and document the live PVC exception. Otherwise the next engineer will wonder why data-app-2 is smaller than its siblings.

Step 4: Monitor the resize and validate the result

Watch events and status:

kubectl get pvc data-app-0 -n prod -w
kubectl describe pvc data-app-0 -n prod

Two conditions matter:

  • Resizing: the controller is expanding the backend volume.
  • FileSystemResizePending: the node still has to grow the filesystem.

Confirm the PV capacity and the PVC's status.capacity reflect the new size. Then check from inside the pod:

kubectl exec -n prod app-0 -- df -h /var/lib/data

Kubernetes supports filesystem expansion for XFS, ext3, and ext4. Some CSI drivers expand mounted filesystems online. Others wait for a pod restart. Follow your driver's documentation, and restart one pod at a time if required.

Kubernetes volume expansion status from backend resize to filesystem growth

When to Resize and What You Need Beforehand

In-place expansion fits when:

  • The workload needs more capacity
  • The current volume type is still right
  • Data must stay with the same pod identity
  • The application tolerates your provider's resize behavior

Take extra care with:

  • Quorum-based databases and single-replica workloads
  • Volumes that are already completely full
  • Active rebalancing or strict uptime targets
  • Applications that don't notice a larger filesystem on their own

System Requirements

  • A supported Kubernetes version
  • A StorageClass with expansion enabled
  • A CSI provisioner implementing controller and/or node expansion
  • A compatible filesystem
  • Sufficient cloud quota
  • RBAC permission to get and patch persistentvolumeclaims in the namespace

What to Gather Before You Start

  • StatefulSet name, namespace, and PVC-to-pod mapping
  • Current and target sizes
  • StorageClass, PV details, and filesystem type
  • Replication state and backup status
  • The provider's documented expansion limits

Operational Readiness

  • A tested rollback or recovery plan
  • Change approval for production
  • Coordination with the application owner
  • A dry run on a non-production StatefulSet

PVC expansion is not a substitute for backups.

Key Parameters, Common Mistakes, and Troubleshooting

A successful resize depends on several layers: the PVC request, the StorageClass and CSI controller, the cloud block volume, the node-side mount, the filesystem, and the application. A failure at any layer can look like a failure at another.

StorageClass and CSI expansion capability

allowVolumeExpansion and driver support decide whether Kubernetes can ask for a larger backend volume at all. Verify the driver's supported volume types, online-expansion behavior, quota constraints, and whether a node-side filesystem step is required. Event messages usually tell you which stage stalled.

Requested size and per-pod PVC selection

Each ordinal has its own claim. Resizing data-app-0 does not resize data-app-1 or future claims. Keep an explicit claim-to-pod map, double-check namespace and target size, and remember requests only move upward.

Filesystem and mount behavior

A larger cloud disk doesn't always mean more usable space in the container. Compare PVC and PV capacity, pod mount state, df output, and kubelet events before deciding a restart is necessary.

Application sequencing and observability

Databases and distributed systems may need replicas expanded in a particular order. A resize can also expose existing disk-full or replication problems. Watch these signals throughout:

StatefulSet PVC resize observability signals across application layers

  • Readiness and replication or quorum health
  • Write errors and latency
  • Restart counts and logs

Common mistakes

  • Editing volumeClaimTemplates and expecting existing PVCs to grow
  • Patching the PV instead of the PVC (a manual PV capacity edit can make Kubernetes conclude no expansion is needed)
  • Deleting pods or PVCs unnecessarily
  • Trying to shrink a claim
  • Resizing every replica at once
  • Ignoring GitOps drift after a manual patch

GitOps drift often follows a manual patch. Argo CD supports resource-scoped ignoreDifferences, but by default it only affects comparison, not sync. Enable RespectIgnoreDifferences=true if you need sync to honor it too.

Troubleshooting issues

PVC stays Pending or shows a resize failure. Review these areas:

  • StorageClass expansion support
  • CSI controller and node logs
  • Provider quota and backend capacity
  • Requested size, access mode, and events

A rejection saying only bound claims can be expanded means the PVC isn't Bound.

PVC shows more capacity, but the app sees the old size. FileSystemResizePending is the usual clue. Also verify:

  • Filesystem expansion status
  • Whether the driver needs a pod restart
  • Container permissions
  • Whether the application rescans disk size

StatefulSet turns unhealthy mid-change. Take these steps in order:

  • Pause further resizes
  • Inspect readiness and replication
  • Restore service per the workload's runbook
  • Avoid deleting PVCs as a shortcut

If a request fails, newer clusters let you lower it, as long as it stays above the PVC's current status.capacity. That recovery feature reached GA in Kubernetes 1.34.

Alternatives to Expanding Existing StatefulSet PVCs This Way

Direct expansion isn't always right. The backend may not support it, the filesystem may not grow safely, the volume may need a different StorageClass, or you may need less storage rather than more.

Data migration to a new PVC or volume

When it's better: unsupported expansion, StorageClass or volume-type changes, shrinking, or a fresh filesystem layout.

Key trade-offs:

  • Backup-and-restore or replication-based migration
  • Temporary extra capacity
  • Application cutover and mount changes
  • Downtime if the application can't replicate data

A CSI snapshot can seed a new PVC through dataSource, but that provisions another volume instead of expanding the old one.

Application-native or operator-managed resizing

When it's better: when storage changes must coordinate with replication, shard rebalancing, or quorum.

Key trade-offs:

  • Safer sequencing across replicas and quorum
  • Operator-specific prerequisites and longer workflows
  • Behavior that differs by operator

Zalando's Postgres Operator adjusts PVCs from spec.volume.size, while Elastic's ECK updates PVCs and recreates the StatefulSet. No pod restart doesn't mean no StatefulSet recreation.

Broader cloud block-storage optimization

When it's better: large multi-cloud estates where the problem goes beyond one StatefulSet: over-provisioned, idle, or manually resized block volumes.

Lucidity's internal figures put average enterprise disk utilization near 30%, with 100+ engineering hours spent on provisioning. Lucidity is a separate autonomous block-storage optimization layer across AWS, Azure, and Google Cloud. AutoScaler and Lumen add visibility and automation at the volume level.

Key trade-offs:

  • Does not directly edit volumeClaimTemplates
  • Requires verifying Kubernetes, CSI, application, and provider compatibility first

Conclusion

Resizing a StatefulSet without recreating it means expanding the generated PVCs one by one. The volumeClaimTemplates blueprint won't retrofit existing volumes.

The safest process:

  • Verifies CSI and StorageClass support
  • Protects application data before changes
  • Expands claims in a controlled sequence
  • Validates backend capacity and filesystem visibility

When expansion is unsupported, or you need to shrink, change StorageClass, or follow application-specific constraints, use a migration or operator-led procedure. Don't delete and recreate stateful storage.

Frequently Asked Questions

What is the recommended upgrade strategy for a StatefulSet in Kubernetes?

Keep manifests in version control, use RollingUpdate (optionally with partition for staged rollouts), and gate each step on readiness and application health. Pod-template upgrades are separate from PVC expansion.

Why use a StatefulSet instead of a Deployment?

StatefulSets give pods stable identities, ordered operations, and one persistent claim per ordinal, which suits databases and distributed systems. Deployments fit interchangeable stateless pods better.

Is it safe to delete a StatefulSet?

Deleting it doesn't necessarily delete PVCs (retention defaults to Retain), but it can still disrupt the application and leave orphaned resources. Don't use deletion as a resize method.

What are the best storage solutions for Kubernetes?

There's no single best. Choose by CSI support, expansion, performance, availability, topology, backup, encryption, access modes, and what your application requires.

Can you resize StatefulSet volumeClaimTemplates directly?

No. Templates are creation blueprints, and the field is immutable. Patch the generated PVCs for supported in-place expansion, and remember new replicas still use the original template size.

Can you shrink a Kubernetes PVC?

Not in place. Kubernetes and most backends don't support reducing a PVC request. Restore or migrate data to a new, smaller PVC, and plan for downtime and cutover.