- Deploy and Configure MongoDB Database Resources >
- Edit a Database Resource >
- Resize Storage for One Database Resource
Resize Storage for One Database Resource¶
On this page
Prerequisites¶
Storage Class Must Support Resizing¶
Make sure the StorageClass and volume plugin provider that the Persistent Volumes use supports resize:
If you don’t have a StorageClass that supports resizing, ask your Kubernetes administrator to help.
Procedure¶
Create or identify a persistent custom resource.¶
Use an existing database resource or create a new one with persistent
storage. Wait until the peristent volume gets to the Running
state.
Example
A database resource with persistent storage would include:
Patch each persistence volume.¶
Invoke the following commands for the entire replica set:
Wait until each Persistent Volume Claim gets to the following condition:
Remove the StatefulSets.¶
Note
This step removes the StatefulSet only. The pods remain unchanged and running.
Delete a StatefulSet resource.
Update the database resource with a new storage value.¶
Update the disk size. Open your preferred text editor and make changes similar to this example:
Example
To update the disk size of the replica set to 2 GB, change the
storage
value in database resource specification:Recreate a StatefulSet resource with the new volume size.
Wait until this StatefulSet achieves the
Running
state.
Update the pods in a rolling fashion.¶
Invoke the following command:
The new pods mount the resized volume.
Validate data exists on the updated Persistent Volume Claim.¶
If the Persistent Volumes were reused, the data that you inserted in Step 2 can be found on the databases stored in Persistent Volumes: