Skip to main content

Create Distributed File Storage Volumes

Deploy distributed file storage volumes using PVCs on CKS

Distributed File Volumes are deployed as Persistent Volumes using Persistent Volume Claims (PVCs).

To create a Persistent Volume for a Distributed File Storage volume:

  • Set the accessMode for the PVC as ReadWriteMany
  • Set the storage class as shared-vast
  • Set the size to the desired size
  • Specify the namespace in the manifest, as PVCs are created and scoped to a namespace.

To create a Distributed File Storage volume in Cloud Console:

  1. Select PVCs in the sidebar.
  2. Click the Create a PVC button.

The Create PVC editor includes both regular text fields and a manifest editor on the right side of the page. You can edit the manifest directly, or use the text fields to configure the PVC; any changes you make in one will be reflected in the other.

  1. Enter the desired name for the PVC in the Name field.
  2. Select the cluster where you want to deploy the PVC in the Cluster field.
  3. Select the namespace for the PVC in the Namespace field.
  4. The Disk Class dropdown may be pre-selected depending on the cluster you selected. If not, select the desired disk class from the dropdown.
  5. Set the size to the desired size in the Size field.
  6. Optionally, you can add labels to the PVC in the Labels field.
  7. Click Submit.

Attaching volumes to pods

Important

You must create and provision storage volumes before they can be attached to a Pod.

To attach a Distributed File volume to a Pod, specify the mountPath and name under the volumeMounts stanza. Then, specify the volumes.name and the persistentVolumeClaim.claimName as shown in the following example:

sample-shared-fs-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: filesystem-storage-example
spec:
containers:
- image: nginx:1.14.2
name: nginx
volumeMounts:
- mountPath: /storage
name: filesystem-storage
volumes:
- name: filesystem-storage
persistentVolumeClaim:
claimName: new-pvc

Once the manifest is created and configured as desired, apply it using kubectl:

Example
$
kubectl apply -f sample-shared-fs-pod.yaml

Once the pod is created, you can verify that the volume is attached by running:

Example
$
kubectl describe pod filesystem-storage-example

This will show the volume attached to the pod in the Volumes section.

Changing volume sizes

After a volume is created and deployed, you can expand it or migrate to a smaller volume.

Existing volumes can't be reduced in size. To use a smaller volume, you'll need to create a new, smaller PVC and migrate your data manually.

Expanding volumes

You can expand deployed Distributed Filesystem Volumes without disrupting running workloads. After you've expanded a volume, you can't downsize it.

To expand a volume in Cloud Console, click the three-dot menu (⋮) on the far right of the volume in the Cloud Console sidebar, then click Edit.

Enter the desired size in the Size field, then click Confirm to expand the volume.