EFS Provisioner for EKS with CSI Driver

About the Amazon EFS CSI Driver

On Amazon EKS, the open-source EFS Container Storage Interface (CSI) driver is used to manage the attachment of Amazon EFS volumes to Kubernetes Pods.

Deploy EFS CSI Driver

We are going to deploy the driver using Helm packages:

helm repo add aws-efs-csi-driver https://kubernetes-sigs.github.io/aws-efs-csi-driver/
helm install aws-efs-csi-driver aws-efs-csi-driver/aws-efs-csi-driver

Verify pods have been deployed:

kubectl get pods -n kube-system

Should return new pods with csi driver:

Output:


NAME                       READY   STATUS    RESTARTS   AGE
efs-csi-node-8hgpt         3/3     Running   0          6h11m
efs-csi-node-d7r47         3/3     Running   0          6h11m
efs-csi-node-fs49j         3/3     Running   0          6h11m

Create Persistent Volume

Next we will deploy a persistent volume using the EFS created.

mkdir ~/environment/efs
cd ~/environment/efs
wget https://eksworkshop.com/beginner/190_efs/efs.files/efs-pv.yaml

We need to update this manifest with the EFS ID created:

sed -i "s/EFS_VOLUME_ID/$FILE_SYSTEM_ID/g" efs-pv.yaml

And then apply:

kubectl apply -f efs-pv.yaml

Next, check if a PVC resource was created. The output from the command should look similar to what is shown below, with the STATUS field set to Bound.

kubectl get pvc -n storage

Output:


NAME                STATUS   VOLUME    CAPACITY   ACCESS MODES   STORAGECLASS   AGE
efs-storage-claim   Bound    efs-pvc   5Gi        RWX            efs-sc         4s

A PV corresponding to the above PVC is dynamically created. Check its status with the following command.

kubectl get pv

Output:


NAME      CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                       STORAGECLASS   REASON   AGE
efs-pvc   5Gi        RWX            Retain           Bound    storage/efs-storage-claim   efs-sc                  20s