Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Planned
Created by Guest
Created on Apr 20, 2023

There have been at least a few issues on Kubernetes Community Operator related to PVC expansion, yet this is not documented anywhere.

There have been at least a few issues on Kubernetes Community Operator related to PVC expansion, yet this is not documented anywhere. Looking at closed issues, one may get an idea that this operation is impossible, but with the latest CSI it should be - it requires some handcrafting. On the other side Enterprise operator has this covered here - https://www.mongodb.com/docs/kubernetes-operator/stable/tutorial/resize-pv-storage/. I suggest writing similar how-to for the Community operator. My currently tested workflow for volume expansion is similar to this explained on the page above, but as for my knowledge Community operator doesn't allow this operation - as it will recreate StatefulSet when you delete, and there's no way for pause reconciliation of MongoDBCommunity. So it requires you to scale down operator deployment for the time of expansion. So it looks like this: 1. Scale down mongodb-kubernetes-operator to 0 2. Dump current mongodb StatefulSet specs to file 3. Delete StatefulSet leaving pods (`--cascade=orphan`) 4. Modify saved StatefulSet specs in the file and update `volumeClaimTemplates` to match your new size requirements And here it splits, as I'm using Longhorn, and it needs some time to detach and resize the volume. Because of that, using `rollout` - as described on the Enterprise operator hasn't worked. So for possibly any other CSI plugin, you should continue as described on the page: 5. Patch PVCs with the new size 6. Re-create StatefulSet with new specs for `volumeClaimTemplates` 7. Rollout restart StatefulSet But in my case, it was like this: 4. Delete one pod (secondary RS members first, primary last - as usual) 5. Wait for PV to be in a detached state 6. Patch PVC 7. Wait for PV to resize 8. Re-create StatefulSet with new specs for `volumeClaimTemplates` 9. Wait for it to reconcile 10. Delete StatefulSet, leaving pods again 11. Repeat the above steps for any other pods in your StatefulSet And finally, make changes to MongoDBCommunity specs to match those in the manually created StatefulSet and scale-up operator.
  • ADMIN RESPONSE
    Aug 1, 2025
    Planned - no fixed date but likely complete within Q2.
  • Attach files