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.
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:
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-pvc.yaml
We need to update this manifest with the EFS ID created:
sed -i "s/EFS_VOLUME_ID/$FILE_SYSTEM_ID/g" efs-pvc.yaml
And then apply:
kubectl apply -f efs-pvc.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:
A PV corresponding to the above PVC is dynamically created. Check its status with the following command.
kubectl get pv
Output: