Skip to content

Latest commit

 

History

History
50 lines (42 loc) · 1.33 KB

File metadata and controls

50 lines (42 loc) · 1.33 KB

Static Provisioning

This example shows how to make a static provisioned EFS persistence volume (PV) mounted inside container.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: efs-pv
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: efs-sc
  csi:
    driver: efs.csi.aws.com
    volumeHandle: [FileSystemId] 

Replace VolumeHandle value with FileSystemId of the EFS filesystem that needs to be mounted.

You can find it using AWS CLI:

>> aws efs describe-file-systems --query "FileSystems[*].FileSystemId"

Deploy the Example Application

Create PV, persistence volume claim (PVC) and storage class:

>> kubectl apply -f examples/kubernetes/static_provisioning/specs/storageclass.yaml
>> kubectl apply -f examples/kubernetes/static_provisioning/specs/pv.yaml
>> kubectl apply -f examples/kubernetes/static_provisioning/specs/claim.yaml
>> kubectl apply -f examples/kubernetes/static_provisioning/specs/pod.yaml

Check EFS filesystem is used

After the objects are created, verify that pod is running:

>> kubectl get pods

Also you can verify that data is written onto EFS filesystem:

>> kubectl exec -ti efs-app -- tail -f /data/out.txt