The Pure Service Orchestrator Kubernetes CSI driver includes support for per-volume basis filesystem (FS) options starting with version 5.0.5.
The feature allows Kubernetes end-users to create persistent volumes with customizable filesystem options on a per-volume basis.
Users can customize the filesystem type (FsType
) with create options (CreateOptions
) during the volume staging phase and customize mount options (MountOptions
) during the volume publish phase.
The feature leverages Kubernetes StorageClass
to carry the customized FS options to the underlying storage backend.
Before this feature, users could only set up these parameters via configuration in the values.yaml file. Then all persistent volumes used the same options, and the settings could not be changed after PSO had loaded.
With this feature, users can customize the FS options for persistent volumes on-the-fly through various StorageClass settings to meet different application needs.
The following dependencies must be true before the customized filesystem options can be used:
- Kubernetes already running, deployed, configured, etc
- For the
MountOptions
feature, ensure you have Kubernetes 1.8+ installed. - PSO correctly installed and using Pure CSI Driver v5.0.5+.
PSO leverages Kubernetes StorageClass
to pass the customized FS options to the underlying storage backend. If the FS options are specified in the StorageClass
, it will override the default values from the values.yaml.
The default values will only apply when no FS options in the StorageClass
.
The CSI external-provisioner allows users to set FsType
via key-value parameters map in the StorageClass
. You can use the pre-defined key "csi.storage.k8s.io/fstype"
to set up the FsType
like this:
parameters:
csi.storage.k8s.io/fstype: vfat
PSO allows users to set CreateOptions
via key-valume parameters map in the StorageClass
. You can use the pre-defined key "createoptions"
to set up the CreateOptions
like this:
parameters:
createoptions: -F 32 -f 2 -S 512 -s 1 -R 32
Persistent Volumes that are dynamically created by a StorageClass
will have the MountOptions
specified in the mountOptions field of the StorageClass
. You can set the options like this:
mountOptions:
- nosuid
- discard
Notes:
-
Native mkfs and mount support: Please make sure your worker nodes support the
FsType
with the correctCreateOptions
you specify in theStorageClass
.During the Volume staging phase, PSO transfer these parameters to our driver and creates the file system for a volume using the command like this
mkfs.<FsType> -o <CreateOptions> /dev/dm-0
. Failure of mkfs operation will lead pod volume attachment failures and pod will be stuck in pending state. It is also true when you mount with incorrectMountOptions
. For FlashBlade, make sure your worker nodes have NFS utilities package installed:
yum install -y nfs-utils
-
FlashBlade support: When you backend storage type is FB, PSO will ignore the
FsType
andCreateOptions
parameters by default since FB does not allow users to format the filesystem when you attach volumes. The default filesystem for FB isnfs
. However, users can still specify theMountOptions
to mount volumes. -
Kubenetes default Filesystem: Kubernetes uses
ext4
as the default file systems. If users do not specifyFsType
in theStorageClass
, K8s will pass the defaultext4
to the driver. PSO recommends users to usexfs
to achieve the best performance. -
Default "discard" mount option: By default, PSO automatically adds a "discard" option while mounting the volume to achieve the best performance unless users specifically add the "nodiscard" option, which PSO does not recommend.
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: pure-block-xfs
labels:
kubernetes.io/cluster-service: "true"
provisioner: pure-csi
parameters:
backend: block
csi.storage.k8s.io/fstype: xfs
createoptions: -q
mountOptions:
- discard
To apply:
kubectl apply -f https://raw.githubusercontent.com/purestorage/helm-charts/master/docs/examples/fsoptions/pure-block-xfs.yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: pure-file-nfs
labels:
kubernetes.io/cluster-service: "true"
provisioner: pure-csi
parameters:
backend: file
mountOptions:
- nfsvers=3
- tcp
To apply:
kubectl apply -f https://raw.githubusercontent.com/purestorage/helm-charts/master/docs/examples/fsoptions/pure-file-nfs.yaml