This example shows how to make a static provisioned EFS persistent volume (PV) mounted inside container.
apiVersion: v1
kind: PersistentVolume
metadata:
name: efs-pv
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
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"
Create PV and persistent volume claim (PVC):
>> 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
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