Skip to content

Commit 3908939

Browse files
committed
Update charts, examples and documentation
1 parent 17ed5fe commit 3908939

File tree

11 files changed

+227
-27
lines changed

11 files changed

+227
-27
lines changed

charts/aws-efs-csi-driver/templates/controller-deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ spec:
7878
{{- end }}
7979
- --v={{ .Values.controller.logLevel }}
8080
- --delete-access-point-root-dir={{ hasKey .Values.controller "deleteAccessPointRootDir" | ternary .Values.controller.deleteAccessPointRootDir false }}
81+
- --delete-provisioned-dir={{ hasKey .Values.controller "deleteProvisionedDir" | ternary .Values.controller.deleteProvisionedDir false }}
8182
env:
8283
- name: CSI_ENDPOINT
8384
value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock

charts/aws-efs-csi-driver/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ controller:
6060
# environment: prod
6161
# region: us-east-1
6262
# Enable if you want the controller to also delete the
63-
# path on efs when deleteing an access point
63+
# path on efs when deleting an EFS access point
6464
deleteAccessPointRootDir: false
65+
# Enable if you want the controller to delete any directories it also provisions
66+
deleteProvisionedDir: false
6567
podAnnotations: {}
6668
podLabel: {}
6769
hostNetwork: false

docs/README.md

Lines changed: 27 additions & 20 deletions
Large diffs are not rendered by default.

examples/kubernetes/dynamic_provisioning/README.md renamed to examples/kubernetes/dynamic_provisioning/access_points/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This example requires Kubernetes 1.17 or later and a driver version of 1.2.0 or
2424
2. Download a `StorageClass` manifest for Amazon EFS.
2525

2626
```sh
27-
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-efs-csi-driver/master/examples/kubernetes/dynamic_provisioning/specs/storageclass.yaml
27+
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-efs-csi-driver/master/examples/kubernetes/dynamic_provisioning/access_points/specs/storageclass.yaml
2828
```
2929

3030
3. Edit [the file](./specs/storageclass.yaml). Find the following line, and replace the value for `fileSystemId` with your file system ID.
@@ -33,7 +33,6 @@ This example requires Kubernetes 1.17 or later and a driver version of 1.2.0 or
3333
fileSystemId: fs-582a03f3
3434
```
3535
Modify the other values as needed:
36-
* `provisioningMode` - The type of volume to be provisioned by Amazon EFS. Currently, only access point based provisioning is supported (`efs-ap`).
3736
* `fileSystemId` - The file system under which the access point is created.
3837
* `directoryPerms` - The directory permissions of the root directory created by the access point.
3938
* `gidRangeStart` (Optional) - The starting range of the Posix group ID to be applied onto the root directory of the access point. The default value is `50000`.
@@ -57,7 +56,7 @@ This example requires Kubernetes 1.17 or later and a driver version of 1.2.0 or
5756
1. Download a manifest that deploys a Pod and a PVC.
5857

5958
```sh
60-
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-efs-csi-driver/master/examples/kubernetes/dynamic_provisioning/specs/pod.yaml
59+
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-efs-csi-driver/master/examples/kubernetes/dynamic_provisioning/access_points/specs/pod.yaml
6160
```
6261

6362
2. Deploy the Pod with a sample app and the PVC used by the Pod.
File renamed without changes.
File renamed without changes.
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
## Dynamic Provisioning
2+
**Important**
3+
You can't use dynamic provisioning with Fargate nodes.
4+
5+
This example shows how to create a dynamically provisioned volume created through a directory on the file system and a Persistent Volume Claim (PVC) and consume it from a pod.
6+
7+
**Prerequisite**
8+
This example requires Kubernetes 1.17 or later and a driver version of 1.5.x or later.
9+
10+
1. Create a storage class for Amazon EFS.
11+
12+
1. Retrieve your Amazon EFS file system ID. You can find this in the Amazon EFS console, or use the following AWS CLI command.
13+
14+
```sh
15+
aws efs describe-file-systems --query "FileSystems[*].FileSystemId" --output text
16+
```
17+
18+
The example output is as follows.
19+
20+
```
21+
fs-582a03f3
22+
```
23+
24+
2. Download a `StorageClass` manifest for Amazon EFS.
25+
26+
```sh
27+
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-efs-csi-driver/master/examples/kubernetes/dynamic_provisioning/directories/specs/storageclass.yaml
28+
```
29+
30+
3. Edit [the file](./specs/storageclass.yaml). Find the following line, and replace the value for `fileSystemId` with your file system ID.
31+
32+
```
33+
fileSystemId: fs-582a03f3
34+
```
35+
36+
Modify the other values as needed:
37+
* `fileSystemId` - The file system under which the access point is created.
38+
* `directoryPerms` - The directory permissions of the root directory created by the access point.
39+
* `basePath` (Optional) - The path on the file system under which the access point root directory is created. If the path isn't provided, the access points root directory is created under the root of the file system.
40+
41+
4. Deploy the storage class.
42+
43+
```sh
44+
kubectl apply -f storageclass.yaml
45+
```
46+
47+
2. Test automatic provisioning by deploying a Pod that makes use of the PVC:
48+
49+
1. Download a manifest that deploys a Pod and a PVC.
50+
51+
```sh
52+
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-efs-csi-driver/master/examples/kubernetes/dynamic_provisioning/specs/pod.yaml
53+
```
54+
55+
2. Deploy the Pod with a sample app and the PVC used by the Pod.
56+
57+
```sh
58+
kubectl apply -f pod.yaml
59+
```
60+
61+
3. Determine the names of the Pods running the controller.
62+
63+
```sh
64+
kubectl get pods -n kube-system | grep efs-csi-controller
65+
```
66+
67+
The example output is as follows.
68+
69+
```
70+
efs-csi-controller-74ccf9f566-q5989 3/3 Running 0 40m
71+
efs-csi-controller-74ccf9f566-wswg9 3/3 Running 0 40m
72+
```
73+
74+
4. After few seconds, you can observe the controller picking up the change \(edited for readability\). Replace `74ccf9f566-q5989` with a value from one of the Pods in your output from the previous command.
75+
76+
```sh
77+
kubectl logs efs-csi-controller-74ccf9f566-q5989 \
78+
-n kube-system \
79+
-c csi-provisioner \
80+
--tail 10
81+
```
82+
83+
The example output is as follows.
84+
85+
```
86+
[...]
87+
1 controller.go:737] successfully created PV pvc-5983ffec-96cf-40c1-9cd6-e5686ca84eca for PVC efs-claim...
88+
```
89+
90+
If you don't see the previous output, run the previous command using one of the other controller Pods.
91+
92+
5. Confirm that a persistent volume was created with a status of `Bound` to a `PersistentVolumeClaim`:
93+
94+
```sh
95+
kubectl get pv
96+
```
97+
98+
The example output is as follows.
99+
100+
```
101+
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
102+
pvc-5983ffec-96cf-40c1-9cd6-e5686ca84eca 20Gi RWX Delete Bound default/efs-claim efs-sc 7m57s
103+
```
104+
105+
6. View details about the `PersistentVolumeClaim` that was created.
106+
107+
```sh
108+
kubectl get pvc
109+
```
110+
111+
The example output is as follows.
112+
113+
```
114+
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
115+
efs-claim Bound pvc-5983ffec-96cf-40c1-9cd6-e5686ca84eca 20Gi RWX efs-sc 9m7s
116+
```
117+
118+
7. View the sample app Pod's status until the `STATUS` becomes `Running`.
119+
120+
```sh
121+
kubectl get pods -o wide
122+
```
123+
124+
The example output is as follows.
125+
126+
```
127+
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
128+
efs-app 1/1 Running 0 10m 192.168.78.156 ip-192-168-73-191.region-code.compute.internal <none> <none>
129+
```
130+
**Note**
131+
If a Pod doesn't have an IP address listed, make sure that you added a mount target for the subnet that your node is in \(as described at the end of [Create an Amazon EFS file system](#efs-create-filesystem)\). Otherwise the Pod won't leave `ContainerCreating` status. When an IP address is listed, it may take a few minutes for a Pod to reach the `Running` status.
132+
133+
1. Confirm that the data is written to the volume.
134+
135+
```sh
136+
kubectl exec efs-app -- bash -c "cat data/out"
137+
```
138+
139+
The example output is as follows.
140+
141+
```
142+
[...]
143+
Tue Mar 23 14:29:16 UTC 2021
144+
Tue Mar 23 14:29:21 UTC 2021
145+
Tue Mar 23 14:29:26 UTC 2021
146+
Tue Mar 23 14:29:31 UTC 2021
147+
[...]
148+
```
149+
150+
2. \(Optional\) Terminate the Amazon EKS node that your Pod is running on and wait for the Pod to be re\-scheduled. Alternately, you can delete the Pod and redeploy it. Complete the previous step again, confirming that the output includes the previous output.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
apiVersion: v1
3+
kind: PersistentVolumeClaim
4+
metadata:
5+
name: efs-claim
6+
spec:
7+
accessModes:
8+
- ReadWriteMany
9+
storageClassName: efs-sc
10+
resources:
11+
requests:
12+
storage: 5Gi
13+
---
14+
apiVersion: v1
15+
kind: Pod
16+
metadata:
17+
name: efs-app
18+
spec:
19+
containers:
20+
- name: app
21+
image: centos
22+
command: ["/bin/sh"]
23+
args: ["-c", "while true; do echo $(date -u) >> /data/out; sleep 5; done"]
24+
volumeMounts:
25+
- name: persistent-storage
26+
mountPath: /data
27+
volumes:
28+
- name: persistent-storage
29+
persistentVolumeClaim:
30+
claimName: efs-claim
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
kind: StorageClass
2+
apiVersion: storage.k8s.io/v1
3+
metadata:
4+
name: efs-sc
5+
provisioner: efs.csi.aws.com
6+
parameters:
7+
provisioningMode: efs-dir
8+
fileSystemId: fs-92107410
9+
directoryPerms: "700"
10+
basePath: "/dynamic_provisioning" # optional

hack/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
controller:
22
create: true
33
logLevel: 5
4+
serviceAccount:
5+
create: true
6+
deleteProvisionedDir: true
47
node:
58
logLevel: 5
6-
serviceAccount:
7-
controller:
8-
create: true

0 commit comments

Comments
 (0)