CSI-S3

Learn how to configure CSI-S3 for use with Filebase.

What is CSI-S3?

CSI-S3 is a container storage interface developed for S3-compatible storage. Container storage interfaces like CSI-S3 can dynamically allocate buckets and mount them via FUSE inside any container, such as Docker containers.

Read below to learn how to use CSI-S3 with Filebase.

Prerequisites:

1. Download the CSI-S3 GitHub repository into your working directory:

git clone https://github.com/CTrox/csi-s3

2. Create a new Kubernetes secret with the command:

kubectl create secret filebase-config

By default, this will create a file located at secret/filebase-config

3. Open this file and enter the following content:

apiVersion: v1
kind: Secret
metadata:
  namespace: kube-namespace
  name: csi-s3-secret
  namespace: kube-namespace
stringData:
  accessKeyID: FILEBASE_ACCESS_KEY
  secretAccessKey: FILEBASE_SECRET_KEY
  endpoint: https://s3.filebase.com

Replace the following values:

  • FILEBASE_ACCESS_KEY: Filebase Access Key

  • FILEBASE_SECRET_KEY: Filebase Secret Key

4. Next, deploy the driver for CSI-S3:

cd deploy/kubernetes

kubectl create -f provisioner.yaml

kubectl create -f attacher.yaml

kubectl create -f csi-s3.yaml

5. Then create a storage class using the command:

kubectl create -f examples/storageclass.yaml

6. Test the S3 driver with the following workflow:

kubectl create -f examples/pvc.yaml

Make sure that the PVC has been bound:

kubectl get pvc csi-s3-pvc

NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE

csi-s3-pvc Bound pvc-c5d24383235-4634f8507-11e8-9f330e4b 5Gi RWO csi-s3 12m

Then create and start a test pod:

kubectl create -f examples/pod.yaml

CSI-S3 will create a new bucket for each volume you create by default. The bucket will match the Volume’s ID.

To set configure a custom bucket name, edit the examples/storageclass.yaml file to reflect the following content:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: csi-s3-existing-bucket
provisioner: ch.ctrox.csi.s3-driver
parameters:
  mounter: rclone
  bucket: filebase-bucket name

Note: This requires rClone to be installed to mount the bucket locally. For more information on rClone, check out our documentation here.

Last updated