FSx for Lustre CSI Driver
Before diving into this section, you should be familiar with the Kubernetes storage objects (volumes, persistent volumes (PV), persistent volume claims (PVC), dynamic provisioning and ephemeral storage) that were introduced in the main Storage section.
The Amazon FSx for Lustre Container Storage Interface (CSI) Driver provides a CSI interface that allows Amazon EKS clusters to manage the lifecycle of Amazon FSx for Lustre file systems. This enables you to run stateful containerized applications that require high-performance parallel file storage.
The following architecture diagram illustrates how we will use FSx for Lustre as persistent storage for our EKS pods:

To utilize Amazon FSx for Lustre on our EKS cluster, we need to install the FSx for Lustre CSI Driver. The driver implements the CSI specification which allows container orchestrators to manage Amazon FSx for Lustre file systems throughout their lifecycle.
As part of the lab preparation, an IAM role has already been created for the CSI driver to call the appropriate AWS APIs.
We'll install the FSx for Lustre CSI driver as an EKS add-on:
Let's verify the driver is running in our EKS cluster:
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
fsx-csi-node 3 3 3 3 3 kubernetes.io/os=linux 52s
The FSx for Lustre CSI driver supports both dynamic and static provisioning. With dynamic provisioning, the driver creates a new FSx for Lustre file system on demand when a PersistentVolumeClaim (PVC) is created. With static provisioning, a pre-existing FSx for Lustre file system is associated with a PersistentVolume (PV) for consumption within Kubernetes. In this lab, we'll use static provisioning with a file system that has been pre-provisioned as part of the lab setup.
An FSx for Lustre file system has been pre-provisioned for us as part of the lab setup, along with the required security group that allows Lustre traffic. Let's get its ID which we'll need later:
fs-0123456789abcdef0
We also need the DNS name and mount name of the file system for our StorageClass:
Next, we'll create a StorageClass that uses static provisioning with our pre-created FSx for Lustre file system.
Let's examine the fsxlstorageclass.yaml file:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fsx-lustre-sc
provisioner: fsx.csi.aws.com
parameters:
subnetId: "$FSXL_SUBNET_ID"
securityGroupIds: "$FSXL_SG"
deploymentType: PERSISTENT_2
perUnitStorageThroughput: "125"
dataCompressionType: "LZ4"
reclaimPolicy: Delete
volumeBindingMode: Immediate
Set the provisioner parameter to fsx.csi.aws.com for the FSx for Lustre CSI provisioner
Assign the subnet ID where the file system resides
Assign the security group ID for Lustre traffic
Apply the kustomization:
storageclass.storage.k8s.io/fsx-lustre-sc created
Let's examine the StorageClass:
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
fsx-lustre-sc fsx.csi.aws.com Delete Immediate false 10s
Now we'll also create a PersistentVolume and PersistentVolumeClaim that reference our pre-provisioned FSx for Lustre file system:
persistentvolume/fsxl-pv created
persistentvolumeclaim/fsxl-claim created
Let's verify the PVC is bound:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
fsxl-claim Bound fsxl-pv 1200Gi RWX fsx-lustre-sc 10s
Now that we understand the FSx for Lustre StorageClass and how the FSx for Lustre CSI driver works, we're ready to proceed to the next step where we'll modify the UI component to use the FSx for Lustre volume for storing product images.