Weka CSI Plugin
This page describes the Weka CSI Plugin prerequisites, capabilities, deployment, and usage.
Overview
The Container Storage Interface (CSI) is a standard for exposing arbitrary block and file storage systems to containerized workloads on Container Orchestration Systems (COs) like Kubernetes.
The Weka CSI Plugin provides the creation and configuration of persistent storage external to Kubernetes. CSI replaces plugins developed earlier in the Kubernetes evolution. It replaces the hostPath
method to expose WekaFS mounts as Kubernetes volumes.
Interoperability
CSI protocol: 1.0-1.2
Kubernetes: 1.18 - 1.2
WekaFS: 3.8 and up
AppArmor and SELinux are not supported yet
Note: Quota enforcement on persistent volumes requires WekaFS version 3.13 and up
Prerequisites
Privileged mode must be allowed on the Kubernetes cluster
The following Kubernetes feature gates must be enabled: DevicePlugins, CSINodeInfo, CSIDriverRegistry, ExpandCSIVolumes (if not changed, they should be enabled by default)
A Weka cluster is installed and accessible from the Kubernetes worker nodes
The Weka client is installed on the Kubernetes worker nodes
It is recommended to use a Weka client which is part of the cluster rather than a stateless client
If the Kubernetes nodes are part of the Weka cluster (converged mode on the Weka servers), make sure the Weka processes come up before
kubelet
Filesystems are pre-configured on the Weka system
Capabilities
Supported capabilities
Static and dynamic volumes provisioning
Mounting a volume as a WekaFS filesystem directory
All volume access modes are supported: ReadWriteMany, ReadWriteOnce, and ReadOnlyMany
Volume expansion
Quota enforcement on persistent volumes
Note: Quota enforcement on persistent volumes requires WekaFS version 3.13 and up. For additional information about enforcing quota on existing persistent volumes, refer to the Upgrading Legacy Persistent Volumes for Capacity Enforcement section
Unsupported capabilities
Snapshots
Deployment
The Weka CSI Plugin deployment can be performed with a Helm chart from the official Weka ArtifactHub repository.
Installation
On your workstation (assuming connectivity to Kubernetes cluster), add the csi-wekafs
repository:
Install the plugin by issuing the following command:
On successful installation the following output will be shown:
Upgrade
Clean Up a Direct Deployment of CSI Driver
Note: Upgrading a plugin deployed directly (via deploy.sh
script) is not supported. This section describes the procedure to clean up the existing CSI plugin components. After cleanup, proceed to the Installation section.
If the previous version was installed using Helm, you can safely skip this section.
Download the csi-wekafs
git repository
Assuming connectivity to Kubernetes cluster is valid, run the following script to remove the CSI driver components:
Upgrade an Existing Helm Release
Note: If you plan to upgrade existing Weka CSI plugin deployment and enable directory quota enforcement for already existing volumes, please refer to the Binding Legacy Volumes to API section.
If not yet configured, add the Helm repository as defined in the Installation section.
Execute the following command:
A successful upgrade will produce the following output:
CSI Plugin and WekaFS Cluster Software Upgrade
The CSI Plugin fetches the WekaFS cluster capabilities during the first login to the API endpoint and caches it throughout the login refresh token validity period, to improve the efficiency and performance of the plugin.
However, the WekaFS cluster upgrade might come unnoticed if performed during this time window, continuing to provision new volumes in legacy mode.
In order to expedite the update of the Weka cluster capabilities, it is recommended to delete all the CSI Plugin pods, to invalidate the cache. The pods will then be restarted.
Storage Class Configuration
The Weka CSI Plugin supports both dynamic (persistent volume claim) and static (persistent volume) volume provisioning. For provisioning either type of a persistent volume, a Storage Class must exist in Kubernetes deployment that matches the Weka cluster configuration.
In the Legacy communication model, the Weka CSI Plugin does not communicate with the Weka cluster via API and solely relies on in-band communication via the data plane. This configuration does not provide extended configuration abilities.
In the API-Based communication model, the Weka CSI Plugin communicates with the Weka cluster using REST API, leveraging this integration to provide extended abilities, such as strict enforcement of volume capacity usage via integration with WekaFS directory quota functionality.
Note: Only the API-Based communication model will be maintained and enhanced with new capabilities. If you are running the legacy CSI plugin, it is advisable to replace it with the API-Based one.
Legacy Communication Model
This model assumes no API connectivity to the Weka cluster. As a result, the functionality provided by the Weka CSI plugin is limited.
Note: This section refers to the configuration of the CSI plugin prior to version v0.7.0
Although this configuration is supported in version 0.7.0 and up, the user is encouraged to upgrade any existing deployment of the Weka CSI plugin to the API-based model
It is first required to define a storage class to use the Weka CSI Plugin.
Storage Class Example
Storage Class Parameters
Parameter
Description
Limitations
filesystemName
The name of the Weka filesystem to create directories in as Kubernetes volumes
The filesystem should exist in the Weka cluster
Apply the StorageClass and check it has been created successfully:
It is possible to define multiple storage classes with different filesystems.
API-Based Communication Model
In the API-based model, the API endpoint addresses and authentication credentials must be provided to the Weka CSI plugin in order to establish a REST API connection with the Weka cluster and perform configuration tasks on it.
The information is stored securely in Kubernetes secret, which is, in turn, referred to by the Storage Class.
Note: This section refers to the configuration of CSI plugin version v0.7.0 and up.
Note: Directory quota integration requires WekaFS software version v3.13.0 and up.
Note: Authenticated mounts for filesystems set with auth-required=true
, and filesystems in the non-root organization, require WekaFS software version v3.14.0 and up.
Note: It is recommended to deploy the CSI plugin in API-Based communication model even if the Weka cluster is below version v3.13.0
Volumes provisioned using the API-Based model on older Weka clusters, do not support capacity enforcement, and are still considered "Legacy". However, they can be easily upgraded to capacity enforcement capabilities after the Weka cluster upgrade.
Secret Data Example
Secret Data Parameters
Note: Make sure that all data is base64-encoded when creating a secret.
Key
Description
Notes
username
The user name for API access to the Weka cluster, in base64 encoding.
Must have at least read-write permissions in the organization. It is recommended to create a separate user with admin privileges for the CSI plugin
password
The user password for API access to the Weka cluster, in base64 encoding.
organization
The Weka organization name for the user, in base64 encoding (use Root
if you only have one organization).
Multiple secrets may be used to provide access to multiple organizations, which in turn will be specified in different storage classes
scheme
The URL scheme used to commnicate with the Weka cluster API.
http
or https
can be used. The user must ensure that the Weka cluster was configured to use the same connection scheme.
endpoints
Comma-separated list of endpoints consisting of IP address and port, e.g.
172.31.15.113:14000,172.31.12.91:14000
The management IP addresses of at least 2 backend hosts should be provided for redundancy.
Apply the Secret and check it has been created successfully:
Note: To provision CSI volumes on filesystem residing in non-root organizations, or filesystems set with auth-required=true,
CSI plugin of version 0.7.4 or higher is required, as well as Weka software of version 3.14 or higher
Storage Class Example
Storage Class Parameters
Parameter
Description
filesystemName
The name of the Weka filesystem to create directories in as Kubernetes volumes.
The filesystem must exist on the Weka cluster
The filesystem may not be defined as "authenticated"
capacityEnforcement
Can be HARD
or SOFT
HARD
: strictly enforce quota and deny any write operation to the persistent volume consumer until space is freed upSOFT
: do not strictly enforce the quota, but create an alert on the Weka cluster
ownerUid
Effective User ID of the owner user for the provisioned CSI volume. Might be required for application deployments running under non-root accounts. Defaults to 0
ownerGid
Effective Group ID of the owner user for the provisioned CSI volume. Might be required for application deployments running under non-root accounts. Defaults to 0
permissions
Unix permissions for the provisioned volume root directory, in octal format. Must be set in quotes. Defaults to "0775"
csi.storage.k8s.io/provisioner-secret-name
Name of the K8s secret, e.g. csi-wekafs-api-secret
It is recommended to use an anchor definition in order to avoid mistakes since the same value has to be entered in additional fields below, according to the CSI spec definitions. Refer to the example above for exact formatting.
csi.storage.k8s.io/provisioner-secret-namespace
The namespace the secret is located in.
The secret does not have to be located in the same namespace as the CSI plugin is installed.
It is recommended using an anchor definition in order to avoid mistakes since the same value has to be entered in additional fields below, accordings to the CSI spec definitions. Refer to the example above for exact formatting.
Apply the StorageClass and check it has been created successfully:
It is possible to define multiple storage classes with different filesystems.
The same secret may be reused for multiple storage classes, as long as credentials are valid to access the filesystem
Several secrets may be used, e.g., for different organizations on the same Weka cluster, or for different Weka clusters spanning across the same Kubernetes cluster
Note: Multiple weka cluster connections from the same Kubernetes node are not supported in the current release of Weka software.
However, different Kubernetes nodes within the same cluster (e.g., in different regions or availability zones) can be connected to different Weka clusters. In such a case, provided that the Weka CSI plugin can access the Weka cluster REST API, a single CSI plugin instance can orchestrate persistent volume provisioning on multiple clusters.
Provision Usage
Dynamic Provisioning
Using a similar storage class to the above, it is possible to define a persistent volume claim (PVC) for the pods.
Persistent Volume Claim Example
Persistent Volume Claim Parameters
Parameter
Description
Limitations
spec.accessModes
The volume access mode
ReadWriteMany
, ReadWriteOnce
, or ReadOnlyMany
spec.storageClassName
The storage class to use to create the PVC
Must be an existing storage class
spec.resources.requests.storage
A desired capacity for the volume
The capacity quota is not enforced but is stored on the filesystem directory extended attributed for future use
Apply the PersistentVolumeClaim and check it has been created successfully:
Note: The directory will be created inside the filesystem under csi-volumes
directory, starting with the volume name.
Static Provisioning
The Kubernetes admin can prepare some persistent volumes in advance to be used by pods, they should be an existing directory, and can contain pre-populated data to be used by the PODs.
It can be a directory previously provisioned by the CSI or a pre-existing directory in WekaFS. To expose an existing directory in WekaFS via CSI, define a persistent volume, and link a persistent volume claim to this persistent volume.
Persistent Volume Example
Persistent Volume Parameters
Parameter
Description
Limitations
spec.accessModes
The volume access mode
ReadWriteMany
, ReadWriteOnce
, or ReadOnlyMany
spec.storageClassName
The storage class to use to create the PV
Must be an existing storage class
spec.capacity.storage
A desired capacity for the volume
The capacity quota is not enforced but is stored on the filesystem directory extended attributed for future use
spec.csi.volumeHandle
A string specifying a previously created path
A string containing the volumeType (dir/v1
) filesystem name, and the directory path. E.g. dir/v1/podsFilesystem/my-dir
Must be an existing filesystem and path
Apply the PersistentVolume and check it has been created successfully:
Now, bind a PVC to this specific PV, use the volumeName
parameter under the PVC spec
and provide it with the specific PV name.
Persistent Volume Claim for Static Provisioning Example
Persistent Volume Claim for Static Provisioning Example
Parameter
Description
Limitations
spec.accessModes
The volume access mode
ReadWriteMany
, ReadWriteOnce
, or ReadOnlyMany
spec.storageClassName
The storage class to use to create the PVC
Must be the same storage class as the PV requested to bind in spec.volumeName
spec.resources.requests.storage
A desired capacity for the volume
The capacity quota is not enforced but is stored on the filesystem directory extended attributed for future use
spec.volumeName
A name of a pre-configured persistent volume
Must be an existing PV name
Apply the PersistentVolumeClaim and check it has been created successfully:
The PV will change the status to Bound
and state the relevant claim it is bounded to:
Launching an Application using Weka as the POD's Storage
Now that we have a storage class and a PVC in place, we can configure the Kubernetes pods to provision volumes via the Weka system.
We'll take an example application that echos the current timestamp every 10 seconds, and provide it with the previously created pvc-wekafs-dir
PVC.
Note that multiple pods can share a volume produced by the same PVC as long as the accessModes
parameter is set to ReadWriteMany
.
Now we will apply that pod:
Kubernetes will allocate a persistent volume and attach it to the pod, it will use a directory within the WekaFS filesystem as defined in the storage class mentioned in the persistent volume claim. The pod will be in Running
status, and the temp.txt
file will get updated with occasional date
information.
Upgrading Legacy Persistent Volumes for Capacity Enforcement
Binding Legacy Volumes to API
Capacity enforcement and integration with WekaFS directory quotas require several prerequisites:
Weka CSI plugin version 0.7.0 and up
WekaFS software version v3.13.0 and up
Weka CSI plugin ability to communicate with WekaFS using REST API, and correlate between a certain persistent volume and the WekaFS cluster serving this volume.
In the API-Based communication model, Kubernetes StorageClass refers to a secret that describes all the required parameters for API calls to the Weka cluster. However, this is not the situation in the legacy communication model, where the storage class doesn't specify the API credentials.
Kubernetes does not allow modification of StorageClass parameters, hence every volume created with the legacy-model storage class will never report its credentials.
Weka CSI Plugin 0.7.0 provides a special configuration mode in which legacy volumes can be bound to a single secret, in turn referring to a single WekaFS cluster API connection parameters. In this configuration mode, every request to serve (create, delete, expand...) a legacy Persistent Volume (or Persistent Volume Claim) that originates from a Legacy Storage Class (without reference to an API secret) will be communicated to that cluster.
Note: Volumes provisioned by the CSI Plugin of version 0.7.0 in the API-Based communication model, but on older versions of the Weka cluster (below version 3.13.0), are still provisioned in legacy mode.
However, since the storage class already contains the secret reference, specifying the legacyVolumeSecretName
parameter is unnecessary, and you can safely skip to the next chapter.
This configuration can be applied following these two steps:
Create a Kubernetes secret that describes the API communication parameters for legacy volumes.
The format of the secret is identical to the secret defined in the API-Based Communication Model section
This secret must be located in the same Kubernetes namespace of the Weka CSI Plugin
Set the
legacyVolumeSecretName
parameter to match the name of secret above during plugin upgrade or installationThis can be done by directly modifying the
values.yaml
or by explicitly setting the parameter during the Helm upgrade:
Note: The Kubernetes secret must be created before executing the helm upgrade. Otherwise, the CSI Plugin components will remain in a Pending
state after the upgrade.
Upgrading Legacy Volumes
Once the volume to API binding configuration described in the previous section is performed, the volumes may be migrated by binding a new WekaFS directory quota object to an existing persistent volume.
Weka provides a migration script that automates the process.
Note: This procedure must be performed only once, and can be performed from any Linux host that is connected to the same WekaFS cluster. Additional runs of the script will migrate only those volumes that were created in legacy mode after the migration process. It is safe to execute the migration script multiple times, although usually this should not be required.
Note: The migration process might take significant time to complete and depends on a number of persistent volumes and their actual capacity. The migration process is performed transparently and does not require downtime.
Check out the csi-wekafs
repository from any host that is connected to WekaFS cluster:
Execute the migration script by issuing the following command, where <filesystem_name>
states the filesystem name which the CSI volumes are located on, and optional <csi_volumes_dir>
parameter states the directory inside the filesystem where CSI volumes are stored (only if the directory differs from default values)
Note: On a stateless client, the --endpoint-address
must be specified in order to successfully mount a filesystem, while on a host which is part of the Weka cluster (either client or backend) this is not necessary.
Note: If multiple filesystems are used, the script must be executed for each filesystem
For example:
Note: The migration script requires several dependencies, which must be installed in advance: jq
, xattr
, getfattr
, setfattr
Refer to the specific OS package management documentation to install the necessary packages.
Troubleshooting
Useful Commands
Here are some useful basic commands to check the status and debug the service:
Known Issues
Mixed Hugepages Size Issue
Due to a Kubernetes v1.18 issue with allocating mixed hugepages sizes (https://github.com/kubernetes/kubernetes/pull/80831) is required that the Weka system will not try to allocate mixed sizes of hugepages on the Kubernetes nodes.
To workaround the Kubernetes issue (required only if the default memory for the client has been increased):
If the Weka client is installed on the K8s nodes via a manual stateless client mount, set the
reserve_1g_hugepages
mount option tofalse
in the mount command.If this is a Weka server or a Weka client, which is part of the Weka cluster, contact the Weka customer support team.
Last updated