Expand or delete PVCs
Follow the instructions on this page to either expand or delete Persistent Volume Claims (PVCs). These actions are often necessary to manage storage efficiently based on the application's requirements. For instance, you might need to increase the storage capacity of a PVC to accommodate growing data, or delete unused PVCs to free up resources.
Expand a PVC
-
Edit the PVC specification:
Run the following command to open the PVC specification for editing. This step allows you to modify the PVC's configuration to reflect the required storage size.kubectl edit pvc <pvc-name> -n <pvc-namespace> -
Modify the
storagefield:
Locate theresources.requests.storagefield in thespecsection and update it to the desired storage size. Here is an example specification:spec:accessModes:- ReadWriteOnceresources:requests:storage: 2GistorageClassName: sc-portworx-fa-direct-accessvolumeMode: FilesystemvolumeName: pvc-7ba7c112-xxxx-xxxxThis change specifies the new storage capacity for the PVC.
-
Apply the changes:
Save the modified specification. This action triggers Kubernetes to resize the PVC to match the updated storage request.