Skip to main content

Create a Distributed File Storage Volume

Deploy a Distributed File Storage volume 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

Deployed Distributed Filesystem Volumes can be expanded without disrupting running workloads.

Important

Shrinking volumes is not supported - volumes cannot be downsized after they are expanded.

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"}}}}'