Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update volume path example for accessing multiple volumes within the same EFS filesystem #107

Merged
merged 1 commit into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deploy/kubernetes/overlays/dev/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ bases:
images:
- name: amazon/aws-efs-csi-driver
newTag: latest
newName: chengpan/aws-efs-csi-driver
2 changes: 1 addition & 1 deletion examples/kubernetes/static_provisioning/specs/pv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ spec:
storageClassName: efs-sc
csi:
driver: efs.csi.aws.com
volumeHandle: fs-4af69aab
volumeHandle: fs-e8a95a42
13 changes: 6 additions & 7 deletions examples/kubernetes/volume_path/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ Similar to [static provisioning example](../static_provisioning). A sub director

**Note**: this feature requires the sub directory to mount precreated on EFS before consuming the volume from pod.

### Edit [Persistence Volume Spec](./specs/pv.yaml)
### Edit [Persistence Volume Spec](./specs/example.yaml)
```
apiVersion: v1
kind: PersistentVolume
metadata:
name: efs-pv
name: efs-pv1
spec:
capacity:
storage: 5Gi
Expand All @@ -19,11 +19,9 @@ spec:
storageClassName: efs-sc
csi:
driver: efs.csi.aws.com
volumeHandle: [FileSystemId]
volumeAttriburtes:
path: /a/b/c/
volumeHandle: [FileSystemId]:[Path]
```
Replace `VolumeHandle` value with `FileSystemId` of the EFS filesystem that needs to be mounted. Note that the path under `volumeAttriburtes` is used as the path from the root of EFS filesystem.
Replace `FileSystemId` of the EFS filesystem ID that needs to be mounted. And replace `Path` with a existing path on the filesystem.

You can find it using AWS CLI:
```sh
Expand All @@ -46,5 +44,6 @@ After the objects are created, verify that pod is running:
Also you can verify that data is written onto EFS filesystem:

```sh
>> kubectl exec -ti efs-app -- tail -f /data/out.txt
>> kubectl exec -ti efs-app -- tail -f /data-dir1/out.txt
>> kubectl exec -ti efs-app -- ls /data-dir2
```
55 changes: 43 additions & 12 deletions examples/kubernetes/volume_path/specs/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,54 @@ provisioner: efs.csi.aws.com
apiVersion: v1
kind: PersistentVolume
metadata:
name: efs-pv
name: efs-pv1
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: efs-sc
csi:
driver: efs.csi.aws.com
volumeHandle: fs-0434d1e6
volumeAttributes:
path: /a/b/c/
volumeHandle: fs-e8a95a42:/dir1
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim
name: efs-claim1
spec:
accessModes:
- ReadWriteOnce
- ReadWriteMany
storageClassName: efs-sc
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: efs-pv2
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: efs-sc
csi:
driver: efs.csi.aws.com
volumeHandle: fs-e8a95a42:/dir2
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim2
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc
resources:
requests:
Expand All @@ -43,11 +69,16 @@ spec:
- name: app
image: centos
command: ["/bin/sh"]
args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"]
args: ["-c", "while true; do echo $(date -u) >> /data-dir1/out.txt; sleep 5; done"]
volumeMounts:
- name: persistent-storage
mountPath: /data
- name: efs-volume-1
mountPath: /data-dir1
- name: efs-volume-2
mountPath: /data-dir2
volumes:
- name: persistent-storage
- name: efs-volume-1
persistentVolumeClaim:
claimName: efs-claim1
- name: efs-volume-2
persistentVolumeClaim:
claimName: efs-claim
claimName: efs-claim2