Skip to content

Static Provisioning

Static provisioning lets you mount an existing flexFS volume into Kubernetes pods. This works with both the Enterprise and Community editions.

  • The flexFS CSI driver is installed
  • A flexFS volume already exists (created during server installation or via configure.flexfs)
  • You have a Secret containing the admin server address and an account token

Create the PersistentVolumeClaim and PersistentVolume

Section titled “Create the PersistentVolumeClaim and PersistentVolume”
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: flexfs-static
namespace: default
spec:
storageClassName: ""
accessModes:
- ReadWriteMany
resources:
requests:
storage: 8Ei
apiVersion: v1
kind: PersistentVolume
metadata:
name: flexfs-static
spec:
storageClassName: ""
accessModes:
- ReadWriteMany
capacity:
storage: 8Ei
csi:
driver: csi.flexfs.io
volumeHandle: "<VOLUME-NAME>"
nodePublishSecretRef:
name: flexfs-secret
namespace: default
claimRef:
name: flexfs-static
namespace: default

Replace <VOLUME-NAME> with the name of your existing flexFS volume.

| Field | Description | |---|---| | storageClassName: "" | Empty string prevents Kubernetes from using a default StorageClass. | | csi.driver | Must be csi.flexfs.io. | | csi.volumeHandle | The name of the flexFS volume to mount. This is the volume name as shown in configure.flexfs or the free server. | | csi.nodePublishSecretRef | Reference to the Kubernetes Secret containing adminAddr and token. | | claimRef | Pre-binds the PV to the PVC so they pair immediately. |

The Secret must contain at minimum the adminAddr and token fields:

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

For encrypted volumes, add the secret field:

stringData:
adminAddr: "<ADMIN-ADDR>"
token: "<ACCOUNT-TOKEN>"
secret: "<ENCRYPTION-SECRET>"

See the Secret field reference for all supported fields.

Terminal window
kubectl apply -f secret.yaml
kubectl apply -f static-volume.yaml
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-static

To mount the volume as read-only, set readOnly: true on the PV:

spec:
csi:
driver: csi.flexfs.io
volumeHandle: "<VOLUME-NAME>"
readOnly: true
nodePublishSecretRef:
name: flexfs-secret
namespace: default

You can pass additional mount options via mountOptions on the PV:

spec:
csi:
driver: csi.flexfs.io
volumeHandle: "<VOLUME-NAME>"
nodePublishSecretRef:
name: flexfs-secret
namespace: default
mountOptions:
- acl
- xattr
- verbose

The CSI driver supports up to 10 volumes per node. Each volume gets its own base FUSE mount at /var/lib/kubelet/flexfs/<volume-name>/. Multiple pods referencing the same volume share a single base mount via bind mounts.