Using EFS csi driver, do I create multiple PV for each path with the same volumeHandle and how do I specify which PV for the PVC?

2/28/2020

See below I have directories in EFS - data and logs. Do I need to create a different PV if I need to use a subpath? And if I do, how do I specify the PV to use for the PVC?

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: efs-pv-data
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: efs-sc
  csi:
    driver: efs.csi.aws.com
    {{/*    same EFS ID*/}}
    volumeHandle: fs-ABC1234
    volumeAttributes:
      path: /data

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: efs-pv-logs
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: efs-sc
  csi:
    driver: efs.csi.aws.com
    {{/*    same EFS ID*/}}
    volumeHandle: fs-ABC1234
    volumeAttributes:
      path: /logs

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: efs-claim-data
  namespace: my-app
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: "efs-sc"
  resources:
    requests:
      storage: 5Gi
-- alltej
aws-efs
kubernetes
persistent-volume-claims
persistent-volumes

0 Answers