Urgent.News

What's breaking now, across thousands of outlets.

Tech

StatefulSet and CSI: Resizing a Production Volume Without Losing a Single Byte

Every StatefulSet eventually hits the same wall: the 50 Gi volume you provisioned eighteen months ago for a PostgreSQL replica is at 92 %, the WAL is growing, and the on-call rotation is getting alerts at 03:00. The good news is that the CSI spec has supported online volume expansion for years. The bad news is that StatefulSet.spec.volumeClaimTemplates is immutable, so the obvious kubectl edit…

StatefulSets and CSI allow for online volume expansion without data loss in Kubernetes production environments. However, expanding a PVC created via a static volumeClaimTemplates entry in a StatefulSet is more complex than it appears. The controller creates the PVC but does not monitor it for size changes. Attempting to edit the template directly leads to validation errors.

The recommended procedure involves recreating the StatefulSet object while patching each PVC individually to expand to the desired size. Important pre-flight checks include verifying the StorageClass allows expansion, ensuring the csi-resizer sidecar is running, checking the PVC retention policy to prevent accidental data loss, and taking a backup snapshot.

When expanding, increase the PVC size one ordinal at a time, starting from the highest. Monitor the conditions to confirm successful resizing, which involves both the spec and status fields updating to reflect the new capacity. Proper handling ensures no data is lost during the expansion process.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Your SVG optimizer silently broke your icon. Here's the one-line check.

Your SVG optimizer silently broke your icon. Here's the one-line check. I spent an afternoon comparing SVG optimizers on a set of 28 real icons from Simple Icons. The sizes looked fine.

  • Optimizer replaced path coordinates with "NaN" string
  • Issue due to handling of arc commands and spacing
  • One-line check using "grep" to detect "NaN"

More from Thursday 19 November →