From bcf525f676d41b9b30884edc7e65a05440559226 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Tue, 26 Feb 2019 16:51:39 -0800 Subject: [PATCH] Updaet RWX example to use dynamic provisioning --- .../kubernetes/dynamic_provisioning/README.md | 2 +- examples/kubernetes/multiple_pods/README.md | 38 ++++++------------- examples/kubernetes/multiple_pods/pv.yaml | 17 --------- .../multiple_pods/storageclass.yaml | 3 ++ 4 files changed, 15 insertions(+), 45 deletions(-) delete mode 100644 examples/kubernetes/multiple_pods/pv.yaml diff --git a/examples/kubernetes/dynamic_provisioning/README.md b/examples/kubernetes/dynamic_provisioning/README.md index d055ad73..16b241b3 100644 --- a/examples/kubernetes/dynamic_provisioning/README.md +++ b/examples/kubernetes/dynamic_provisioning/README.md @@ -14,7 +14,7 @@ parameters: securityGroupIds: sg-086f61ea73388fb6b ``` * subnetId - the subnet ID that the FSx for Lustre filesystem should be created inside. -* securityGroupIds - a list of security group IDs that should be attached to the filesystem +* securityGroupIds - a comman separated list of security group IDs that should be attached to the filesystem ### Edit [Persistent Volume Claim Spec](claim.yaml) ``` diff --git a/examples/kubernetes/multiple_pods/README.md b/examples/kubernetes/multiple_pods/README.md index 1a5ed248..41f36142 100644 --- a/examples/kubernetes/multiple_pods/README.md +++ b/examples/kubernetes/multiple_pods/README.md @@ -1,40 +1,24 @@ ## 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. +This example shows how to create a dynamically provisioned FSx for Lustre PV and access it from multiple pods with `ReadWriteMany` access mode. If you are using static provisioning, following steps to setup static provisioned PV with access mode set to `ReadWriteMany` and the rest of steps of consuming the volume from pods are similar. -### Edit Persistent Volume -Edit persistent volume using sample [spec](pv.yaml): +### Edit [StorageClass](storageclass.yaml) ``` -apiVersion: v1 -kind: PersistentVolume +kind: StorageClass +apiVersion: storage.k8s.io/v1 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: - -```sh ->> aws fsx describe-file-systems + name: fsx-sc +provisioner: fsx.csi.aws.com +parameters: + subnetId: subnet-056da83524edbe641 + securityGroupIds: sg-086f61ea73388fb6b ``` +* subnetId - the subnet ID that the FSx for Lustre filesystem should be created inside. +* securityGroupIds - a comman separated list of security group IDs that should be attached to the filesystem ### Deploy the Application Create PV, persistence volume claim (PVC), storageclass and the pods that consume the PV: ```sh >> kubectl apply -f examples/kubernetes/multiple_pods/storageclass.yaml ->> kubectl apply -f examples/kubernetes/multiple_pods/pv.yaml >> kubectl apply -f examples/kubernetes/multiple_pods/claim.yaml >> kubectl apply -f examples/kubernetes/multiple_pods/pod1.yaml >> kubectl apply -f examples/kubernetes/multiple_pods/pod2.yaml diff --git a/examples/kubernetes/multiple_pods/pv.yaml b/examples/kubernetes/multiple_pods/pv.yaml deleted file mode 100644 index 543b283b..00000000 --- a/examples/kubernetes/multiple_pods/pv.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: fsx-pv -spec: - capacity: - storage: 5Gi - volumeMode: Filesystem - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Retain - storageClassName: fsx-sc - csi: - driver: fsx.csi.aws.com - volumeHandle: fs-0199e5a63bd90f796 - volumeAttributes: - dnsname: fs-0199e5a63bd90f796.fsx.us-east-1.amazonaws.com diff --git a/examples/kubernetes/multiple_pods/storageclass.yaml b/examples/kubernetes/multiple_pods/storageclass.yaml index a440bee7..c67072ce 100644 --- a/examples/kubernetes/multiple_pods/storageclass.yaml +++ b/examples/kubernetes/multiple_pods/storageclass.yaml @@ -3,3 +3,6 @@ apiVersion: storage.k8s.io/v1 metadata: name: fsx-sc provisioner: fsx.csi.aws.com +parameters: + subnetId: subnet-056da83524edbe641 + securityGroupIds: sg-086f61ea73388fb6b