EFS Provisioner for EKS: How it Works

The EFS Provisioner is deployed as a Pod that has a container with access to an AWS EFS file system. The container reads a ConfigMap containing the File system ID, Amazon Region of the EFS file system, and the name of the provisioner as shown below. ConfigMap

A StorageClass resource is defined whose provisioner attribute determines which volume plugin is used for provisioning a PersistentVolume (PV). In this case, the StorageClass specifies the EFS Provisioner Pod as an external provisioner by referencing the value of provisioner.name key in the ConfigMap above. ConfigMap

A PersistentVolumeClaim (PVC) resource is created that references the above StorageClass using the annotation volume.beta.kubernetes.io/storage-class. A PVC represents a request for storage by a user. ConfigMap

A sub-directory named data was created under the root of the EFS file system for the EFS Provisioner Pod to use. This is configured in the EFS Provisioner deployment manifest under volumes/nfs/path. This directory is then mounted on to a local directory within the pod specified in the manifest under containers/volumeMounts/mountPath. The EFS Provisioner Pod will create child directories under this directory to back each PV it provisions.
ConfigMap

With the above setup, EKS resources such as Deployments, CronJobs, StatefulSets etc. that need a persistent volume for data storage on the EFS file system may request one by referencing an instance of PVC in their respective YAML manifest such that its claimName attribute under volumes/persistentVolumeClaim matches the name attribute of a PVC definition. If a PV that matches the PVC request does not yet exist, it will be dynamically provisioned and then mounted on to a local directory within the pod specified in the manifest under containers/volumeMounts/mountPath. ConfigMap

If different sets of microservices in your deployment need to share different directories, then you need to create a new instance of a PersistentVolumeClaim for each shared directory. The corresponding PersistentVolume will be backed by a new child directory created under the top-level directory /data on the same EFS file system. There is no need to provision a new instance of an EFS file system unless your data isolation requirements demand as such.