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, and the storage class as shared-vast, as highlighted in the manifest below.

Here is an example of a PVC manifest for deploying a Distributed File Storage volume:

sample-shared-fs.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: new-pvc
namespace: default
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
storageClassName: shared-vast

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

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

Attaching Storage Volumes

Important

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

Attach to Pods

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:

Example
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: filesystem-storage-pvc

Expanding Volumes

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

Shrinking volumes

PVCs 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.

To expand a volume, use kubectl patch to patch the existing volume manifest. For example, to expand a volume to 500Gi, run:

Example
$
kubectl patch pvc my-volume -p \
'{"spec":{"resources":{"requests":{"storage": "500Gi"}}}}'

Volume Size Planning

When planning your volume sizes, keep these considerations in mind:

  • Start larger rather than smaller: You can expand volumes without interrupting running workloads, but PVCs can't be reduced in size
  • Plan for growth: Consider your data growth patterns when setting initial volume sizes
  • Migration for smaller sizes: To use a smaller volume, you'll need to create a new, smaller PVC and migrate your data manually