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 the stable release:
kubectl apply -k "github.com/kubernetes-sigs/aws-efs-csi-driver/deploy/kubernetes/overlays/stable/?ref=release-1.0"
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: