Persistent volume claim for static provisioning example

Content Software for File CLI Reference

Version
4.2.x
Audience
anonymous
Part Number
MK-HCSF001-03
csi-wekafs/examples/static/pvc-wekafs-dir-static.yaml
1 apiVersion: v1
2 kind: PersistentVolumeClaim
3 metadata:
4 name: pvc-wekafs-dir-static
5 spec:
6 accessModes:
7 - ReadWriteMany
8 storageClassName: storageclass-wekafs-dir
9 volumeName: pv-wekafs-dir-static
10 volumeMode: Filesystem
11 resources:
12 requests:
13 storage: 1Gi
Parameter Description Limitation
spec.accessModes The volume access mode ReadWriteMany, ReadWriteOnce, or ReadOnlyMany
spec.storageClassName The storage class to use to create the PVC Must be the same storage class as the PV requested to bind in spec.volumeName
spec.resources.requests.storage A desired capacity for the volume The capacity quota is not enforced but is stored on the filesystem directory extended attributed for future use
spec.volumeName A name of a preconfigured persistent volume Must be an existing PV name

Apply the PersistentVolumeClaim and check it has been created successfully:

# apply 1 the pvc .yaml file
2 $ kubectl apply -f pvc-wekafs-dir-static.yaml
3 persistentvolumeclaim/pvc-wekafs-dir-static created
4
5 # check the pvc resource has been created
6 $ kubectl get pvc
7 NAME STATUS VOLUME CAPACITY ACCES
8 pvc-wekafs-dir-static Bound pv-wekafs-dir-static 1Gi RWX

The PV will change the status to Bound and state the relevant claim it is bounded to:

1 # check the pv resource has been created
2 $ kubectl get pv
3 NAME CAPACITY ACCESS MODES RE
4 pv-wekafs-dir-static 1Gi RWX Re