Creating an NFS Shared Storage Class
Based on the community NFS CSI (Container Storage Interface) storage driver, it provides the capability to access multiple NFS storage systems or accounts.
Unlike the traditional client-server model of NFS access, NFS shared storage utilizes the community NFS CSI (Container Storage Interface) storage plugin, which is more aligned with Kubernetes design principles and allows client access to multiple servers.
TOC
Prerequisites
- An NFS server must be configured, and its access methods must be obtained. Currently, the platform supports three NFS protocol versions:
v3,v4.0, andv4.1. You can executenfsstat -son the server side to check the version information.
Deploying the Alauda Container Platform NFS CSI plugin
Deploying via Web Console
-
Enter Administrator.
-
In the left navigation bar, click Storage > StorageClasses.
-
Click Create StorageClass.
-
On the right side of NFS CSI, click Deploy to navigate to the Plugins page.
-
On the right side of the
Alauda Container Platform NFS CSIplugin, click ⋮ > Install. -
Wait for the deployment status to indicate Deployment Successful before completing the deployment.
Deploying via YAML
Refs to Installing via YAML
Alauda Container Platform NFS CSI is a Non-config plugin, and the module-name is nfs
Creating an NFS Shared Storage Class
-
Click Create Storage Class.
Note: The following content is presented in a form, but you may also choose to complete the operation using YAML.
-
Select NFS CSI and click Next.
-
Refer to the following instructions to configure the relevant parameters.
NOTEThe
subDirfield supports only the following three variables, which the NFS CSI Driver automatically resolves:${pvc.metadata.namespace}: PVC Namespace.${pvc.metadata.name}: PVC Name.${pv.metadata.name}: PV Name.
The
subDirnaming rule MUST guarantee unique subdirectory names. Otherwise, multiple PVCs may share the same subdirectory, causing data conflicts.Recommended Configurations:
${pvc.metadata.namespace}_${pvc.metadata.name}_${pv.metadata.name}<cluster-identifier>_${pvc.metadata.namespace}_${pvc.metadata.name}_${pv.metadata.name}
Designed for multiple Kubernetes clusters sharing the same NFS Server, this configuration ensures clear cluster differentiation by incorporating a cluster-specific identifier (e.g., the cluster name) into the subdirectory naming rules.
Not Recommended Configurations:
-
${pvc.metadata.namespace}-${pvc.metadata.name}-${pv.metadata.name}Avoid - as separators, may lead to ambiguous subdirectory names. For example: If two PVCs are namedns-1/testandns/1-test, both could generate the same subdirectoryns-1-test. -
${pvc.metadata.namespace}/${pvc.metadata.name}/${pv.metadata.name}Do NOT configure subDir to create nested directories. The NFS CSI Driver only deletes the last-level directory${pv.metadata.name}when a PVC is removed, leaving orphaned parent directories on the NFS Server.
-
Once you have confirmed that the configuration information is correct, click Create.