Container Storage Interface (CSI) Drivers
Objective
Deploy the various CSI drivers used by the Panfactum stack.
Background
Compared to networking, storage in kubernetes is relatively straightforward. Storage is exposed to pods via two mechanisms:
- Directly from the available storage on the host operating system 1
- Dynamically, using a Container Storage Interface (CSI) driver
The primary use case for CSI is for attaching storage managed by cloud providers (e.g., AWS EBS). That said, this interface is extremely flexible and can also be used by other utilities to directly mount files inside your pods.
Deploy AWS EBS CSI Driver
The AWS EBS CSI Driver allows you to provision EBS volumes for use in your pods. This is the recommended way to store stateful data (i.e., Database storage) within the Panfactum stack.
We provide the kube_aws_ebs_csi module to deploy the driver.
Let's deploy it now:
-
Create a new directory adjacent to your
aws_eks
module calledkube_aws_ebs_csi
. -
Add a
terragrunt.hcl
to that directory that looks like this. -
Run
pf-tf-init
to enable the required providers. -
Run
terragrunt apply
. -
Verify the pods deployed successfully:
Storage Classes
Note that there are now a couple StorageClass resources in the cluster:
The following classes were installed by the kube_aws_ebs_csi
module:
ebs-standard
: Uses gp3 volumes and deletes the volumes automatically when the utilizing resource is deleted (default)ebs-standard-retained
: Uses gp3 volumes but never deletes the underlying volumes (recommended for production databases)
Next Steps
We will test the storage drivers in the next section where we deploy Vault (which needs persistent storage).
Footnotes
-
This type of storage should be considered ephemeral (temporary) as it inherently linked to the lifetime of the underlying nodes. In the Panfactum stack, nodes can be replaced at any time. ↩