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
storage
field:
Locate theresources.requests.storage
field in thespec
section and update it to the desired storage size. Here is an example specification:spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: sc-portworx-fa-direct-access
volumeMode: Filesystem
volumeName: 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.
Delete a PVC
Run the following command to delete a PVC associated with a FlashArray Direct Access volume. You can use this operation to delete unused PVCs that helps optimize storage resource usage and avoid unnecessary costs.
kubectl delete pvc <pvc-name> -n <pvc-namespace>
persistentvolumeclaim "<pvc-name>" deleted