Post

Your Kubernetes PVCs are probably 3x too big. 400 PVCs at 100Gi requested / 15Gi used = roughly $3,000/mo of empty EBS blocks, and nobody looks because the pods are fine. 7 things a PVC right-sizing agent does that kubectl get pvc never will 🧵

1. Reads two numbers kubelet already exports for every mounted volume: kubelet_volume_stats_used_bytes / kubelet_volume_stats_capacity_bytes then joins kube_persistentvolumeclaim_info with group_left. kubelet knows usage; only kube-state-metrics knows the storageclass and PV.

0 reposts0 likes

Why volumes end up 3x too big, on every cluster: - gp2 sized for IOPS: 3 IOPS/GiB, so 3,000 IOPS meant 1,000 GiB with 80 used - one volumeClaimTemplates 100Gi copy-pasted into Kafka, Redis and a 400 MB job queue - 'we can grow it later' was true, so the default became big

2. Classifies in code, not in the model. Named constants on the PR: MAX_USED_RATIO 0.30 HEADROOM 2.0 FLOOR 20 GiB MIN_SAVINGS $5/mo target = max(20, projected_30d x 2). Flag only if <30% used AND target < 60% of capacity.

3. Guards with predict_linear(kubelet_volume_stats_used_bytes[7d], 30d). A 100Gi volume at 12% used but projected 60Gi in 30 days is a log dir without rotation, not a shrink candidate. That 'growing 4x' finding is worth more than any savings number.

4. Prices honestly. gp2 $0.10/GiB-mo, gp3 $0.08. If it proposes gp2 to gp3 AND a shrink on the same volume, it prices the shrink at the gp3 rate. Double-count once and the first finance reviewer who checks the math stops trusting the whole list.