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

Add example for multiple pods #22

Merged
merged 1 commit into from
Feb 11, 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
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Before the example, you need to:
#### Example links
* [Static provisioning](../examples/kubernetes/static_provisioning/README.md)
* [Dynamic provisioning](../examples/kubernetes/dynamic_provisioning/README.md)
* Accessing the filesystem from multiple pods
* [Accessing the filesystem from multiple pods](../examples/kubernetes/multiple_pods/README.md)

## Development
Please go through [CSI Spec](https://github.com/container-storage-interface/spec/blob/master/spec.md) and [General CSI driver development guideline](https://kubernetes-csi.github.io/docs/Development.html) to get some basic understanding of CSI driver before you start.
Expand Down
57 changes: 57 additions & 0 deletions examples/kubernetes/multiple_pods/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## Multiple Pods Read Write Many
This example shows how to create a static provisioned FSx for Lustre PV and access it from multiple pods with RWX access mode.

### Edit Persistent Volume
Edit persistent volume using sample [spec](pv.yaml):
```
apiVersion: v1
kind: PersistentVolume
metadata:
name: fsx-pv
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Recycle
storageClassName: fsx-sc
csi:
driver: fsx.csi.aws.com
volumeHandle: [FileSystemId]
volumeAttributes:
dnsname: [DNSName]
```
Replace `volumeHandle` with `FileSystemId` and `dnsname` with `DNSName`. Note that the access mode is `RWX` which means the PV can be read and write from multiple pods.

You can get both `FileSystemId` and `DNSName` using AWS CLI:

```
aws fsx describe-file-systems
```

### Deploy the Application
Create PV, persistence volume claim (PVC), storageclass and the pods that consume the PV:
```
kubectl apply -f examples/kubernetes/static_provisioning/storageclass.yaml
kubectl apply -f examples/kubernetes/static_provisioning/pv.yaml
kubectl apply -f examples/kubernetes/static_provisioning/claim.yaml
kubectl apply -f examples/kubernetes/static_provisioning/pod1.yaml
kubectl apply -f examples/kubernetes/static_provisioning/pod2.yaml
```

Both pod1 and pod2 are writing to the same FSx for Lustre filesystem at the same time.

### Check the Application uses FSx for Lustre filesystem
After the objects are created, verify that pod is running:

```
kubectl get pods
```

Also verify that data is written onto FSx for Luster filesystem:

```
kubectl exec -ti app1 -- tail -f /data/out1.txt
kubectl exec -ti app2 -- tail -f /data/out2.txt
```
4 changes: 2 additions & 2 deletions examples/kubernetes/multiple_pods/pv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ spec:
storageClassName: fsx-sc
csi:
driver: fsx.csi.aws.com
volumeHandle: fs-0b88f4c7b6f8772d7
volumeHandle: fs-0199e5a63bd90f796
volumeAttributes:
dnsname: fs-0b88f4c7b6f8772d7.fsx.us-west-2.amazonaws.com
dnsname: fs-0199e5a63bd90f796.fsx.us-east-1.amazonaws.com