Skip to main content
Version: 3.2

Resize a Portworx PVC

This document describes how to dynamically resize a volume (PVC) using Kubernetes and Portworx.

Pre-requisites

  • The StorageClass must have allowVolumeExpansion: true.
  • The PVC must be in use by a Pod.

Example

To resize a Portworx PVC, you can simply edit the PVC spec and update the size. Let's take an example of resizing a MySQL PVC.

  1. Download the [MySQL StorageClass spec]/samples/k8s/mssql/mssql_sc.yml?raw=true) and apply it. Note that the StorageClass has allowVolumeExpansion: true.

  2. Download the [MySQL PVC spec]/samples/k8s/mssql/mssql_pvc.yml?raw=true) and apply it. We will start with a 5GB volume.

  3. Download the [MySQL Deployment spec]/samples/k8s/mssql/mssql_deployment.yml?raw=true), specify your own values for the ACCEPT_EULA and SA_PASSWORD, and apply it. Wail till the pod becomes 1/1 and then proceed to next step.

  4. Run kubectl edit pvc mssql-data and change the size in the "spec" to 10Gi.

After you save the spec, kubectl describe pvc mssql-data should have an entry like below that confirms the volume resize.

Normal  VolumeResizeSuccessful  5s    volume_expand                ExpandVolume succeeded for volume default/mssql-data