title: How to use Same EFS for mounting multiple directories in Kubernetes deployment
body: <p>I am trying to find a solution to make use of the same Amazon EFS for mounting multiple directories in the Kubernetes deployment. Here is my use case</p>
  <ul>
  <li>I have an application named <strong>app1</strong> that needs to persist a directory named &quot;/opt/templates&quot; to EFS</li>
  <li>I have another application named <strong>app2</strong> that needs to persist a directory named &quot;/var/logs&quot; to EFS</li>
  </ul>
  <p>We deploy the applications as a Kubernetes Pod in the Amazon EKS cluster. If i am using the same EFS for both the above mounts, i can see all the files from both the directories &quot;/opt/templates&quot; and &quot;/var/logs&quot; as i am using the same EFS.</p>
  <p>How can i solve the problem of using same EFS for both the application without seeing <strong>app1</strong> mounted files in <strong>app2</strong> directory ? Is it even possible of using the same EFS ID for multiple applications ?</p>
  <p>Here is the Kubernetes manifests i used for for one of the application which includes PersistentVolume, PVC and the Deployment</p>
  <pre><code>----
  apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: efs-pv-1
  spec:
    capacity:
      storage: 2Gi
    volumeMode: Filesystem
    accessModes:
      - ReadWriteMany
    persistentVolumeReclaimPolicy: Retain
    storageClassName: efs-sc-report
    csi:
      driver: efs.csi.aws.com
      volumeHandle: fs-XXXXX
  
  ---
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: efs-pvc-1
  spec:
    accessModes:
      - ReadWriteMany
    storageClassName: efs-sc
    resources:
      requests:
        storage: 2Gi
  ---
  
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: deploy1
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: deploy1
    template:
      metadata:
        labels:
          app: deploy1
      spec:
        containers:
        - name: app1
          image: imageXXXX
          ports:
          - containerPort: 6455
          volumeMounts:
            - name: temp-data
              mountPath: /opt/templates/  
        volumes:
        - name: shared-data
          emptyDir: {}
        - name: temp-data
          persistentVolumeClaim:
            claimName: efs-pvc-1 
  </code></pre>