Skip to content

Dynamic Provisioning (Enterprise)

Dynamic provisioning allows Kubernetes to automatically create a new flexFS volume when a PersistentVolumeClaim is submitted. The CSI controller calls the admin server REST API to create the volume, retrieves a volume token, and makes it available to pods.

  • The flexFS CSI driver is installed
  • An Enterprise admin server is running and reachable from the cluster
  • You have an account token with volume creation permissions

The CSI driver needs the admin server address and an account token to create volumes. Store these in a Kubernetes Secret:

apiVersion: v1
kind: Secret
metadata:
name: flexfs-secret
namespace: default
stringData:
adminAddr: "<ADMIN-ADDR>"
token: "<ACCOUNT-TOKEN>"

Replace <ADMIN-ADDR> with the address of your admin server (for example, admin.example.com:443) and <ACCOUNT-TOKEN> with a valid account token.

Terminal window
kubectl apply -f secret.yaml

The StorageClass tells Kubernetes to use the flexFS CSI provisioner and specifies volume creation parameters:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: flexfs-dynamic
provisioner: csi.flexfs.io
parameters:
csiProvisionerSecretNamespace: default
csiProvisionerSecretName: flexfs-secret
csiNodePublishSecretNamespace: default
csiNodePublishSecretName: flexfs-secret

You can add optional parameters to control volume settings at creation time. See the StorageClass parameters reference for all options.

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: flexfs-encrypted
provisioner: csi.flexfs.io
parameters:
csiProvisionerSecretNamespace: default
csiProvisionerSecretName: flexfs-secret
csiNodePublishSecretNamespace: default
csiNodePublishSecretName: flexfs-secret
blockSize: "4Mi"
compression: "true"
compressionAlgo: "lz4"
encryption: "true"
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: flexfs-dynamic
namespace: default
spec:
storageClassName: flexfs-dynamic
accessModes:
- ReadWriteMany
resources:
requests:
storage: 8Ei
Terminal window
kubectl apply -f dynamic-volume.yaml

Once the PVC is created, the CSI provisioner will:

  1. Call CreateVolume on the flexFS CSI controller
  2. The controller sends a POST /v1/volumes request to the admin server to create a new volume
  3. A PersistentVolume is automatically created and bound to the PVC
apiVersion: v1
kind: Pod
metadata:
name: my-app
spec:
containers:
- name: app
image: ubuntu:latest
command: ["sleep", "infinity"]
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
persistentVolumeClaim:
claimName: flexfs-dynamic

When the PVC is deleted (and the reclaim policy allows it), the CSI controller calls the admin server to retire the volume via DELETE /v1/volumes/for-name/<volume-name>.

FlexFS supports the following CSI access modes:

Access modeSupportedDescription
ReadWriteManyYesMultiple pods can read and write simultaneously
ReadWriteOnceYesSingle pod read-write access
ReadOnlyManyYesMultiple pods with read-only access