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.
Prerequisites
Section titled “Prerequisites”- 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
Step 1: Create a Secret
Section titled “Step 1: Create a Secret”The CSI driver needs the admin server address and an account token to create volumes. Store these in a Kubernetes Secret:
apiVersion: v1kind: Secretmetadata: name: flexfs-secret namespace: defaultstringData: 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.
kubectl apply -f secret.yamlStep 2: Create a StorageClass
Section titled “Step 2: Create a StorageClass”The StorageClass tells Kubernetes to use the flexFS CSI provisioner and specifies volume creation parameters:
apiVersion: storage.k8s.io/v1kind: StorageClassmetadata: name: flexfs-dynamicprovisioner: csi.flexfs.ioparameters: csiProvisionerSecretNamespace: default csiProvisionerSecretName: flexfs-secret csiNodePublishSecretNamespace: default csiNodePublishSecretName: flexfs-secretYou can add optional parameters to control volume settings at creation time. See the StorageClass parameters reference for all options.
Example with custom parameters
Section titled “Example with custom parameters”apiVersion: storage.k8s.io/v1kind: StorageClassmetadata: name: flexfs-encryptedprovisioner: csi.flexfs.ioparameters: csiProvisionerSecretNamespace: default csiProvisionerSecretName: flexfs-secret csiNodePublishSecretNamespace: default csiNodePublishSecretName: flexfs-secret blockSize: "4Mi" compression: "true" compressionAlgo: "lz4" encryption: "true"Step 3: Create a PersistentVolumeClaim
Section titled “Step 3: Create a PersistentVolumeClaim”apiVersion: v1kind: PersistentVolumeClaimmetadata: name: flexfs-dynamic namespace: defaultspec: storageClassName: flexfs-dynamic accessModes: - ReadWriteMany resources: requests: storage: 8Eikubectl apply -f dynamic-volume.yamlOnce the PVC is created, the CSI provisioner will:
- Call
CreateVolumeon the flexFS CSI controller - The controller sends a
POST /v1/volumesrequest to the admin server to create a new volume - A PersistentVolume is automatically created and bound to the PVC
Step 4: Use the volume in a pod
Section titled “Step 4: Use the volume in a pod”apiVersion: v1kind: Podmetadata: name: my-appspec: containers: - name: app image: ubuntu:latest command: ["sleep", "infinity"] volumeMounts: - name: data mountPath: /data volumes: - name: data persistentVolumeClaim: claimName: flexfs-dynamicVolume deletion
Section titled “Volume deletion”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>.
Access modes
Section titled “Access modes”FlexFS supports the following CSI access modes:
| Access mode | Supported | Description |
|---|---|---|
ReadWriteMany | Yes | Multiple pods can read and write simultaneously |
ReadWriteOnce | Yes | Single pod read-write access |
ReadOnlyMany | Yes | Multiple pods with read-only access |
Next steps
Section titled “Next steps”- StorageClass parameters reference
- Static provisioning for pre-existing volumes
- Troubleshooting