This topic explains how to troubleshoot common issues with NAS volumes.
Long mount time for NAS volumes
If you configure the securityContext.fsgroup parameter in an application template, kubelet performs chmod or chown operations on all files in the mounted directory after each mount. The more files in the directory, the longer these operations take, which prolongs the mount time.
Choose one of the following solutions based on your needs:
Solution 1 (Recommended for Kubernetes 1.20 and later): Set
fsGroupChangePolicytoOnRootMismatch. With this setting,chmodandchownoperations run only during the initial mount and only if permissions do not match. Subsequent mounts do not trigger these operations, which restores normal mount times. For more information about thefsGroupChangePolicyparameter, see Configure a security context for a Pod or container.Solution 2 (If fsGroup is not required): Remove the
fsgroupparameter from thesecurityContextsection. IfsecurityContext.fsgroupis not configured, kubelet does not change permissions, and the mount time is not affected.Solution 3 (If you need to specify file ownership): Manually mount the target directory to an ECS instance. Run the
chownandchmodcommands to set the target UID andmode. Then, use the NAS volume with FlexVolume. For more information about how to use a NAS volume with FlexVolume, see Use a statically provisioned NAS volume and Use a dynamically provisioned NAS volume.
NAS volume mount failure due to timeout
This is usually a network isolation issue: the NAS mount target and the cluster are not in the same VPC, which causes a timeout error. Ensure that the mount target and the cluster are in the same VPC, and then retry.
You receive the chown: option not permitted error when you use a NAS volume
The error chown: option not permitted indicates the container lacks permission to change file ownership on the NAS volume. To fix this, start the container with root privileges.
NAS volume mount failure
Mounting a NAS PV fails with the following error:
Unable to mount volumes for pod "dp-earnings-pod_default(906172c6-3d68-11e8-86e0-00163e00****)": timeout expired waiting for volumes to attach/mount for pod "default"/"dp-earnings-pod". list of unattached/unmounted volumes=[vol1 vol2]
This error occurs because the FlexVolume plug-in is not installed on the cluster. To resolve this, install the plug-in by following the instructions in Install and upgrade the FlexVolume plug-in.
PV creation blocked by full controller queue
If the reclaimPolicy in your StorageClass is set to Delete and archiveOnDelete is set to false, the task queue can become full if subdirectories are created faster than the controller can delete them. This prevents the creation of new PVs.
Set archiveOnDelete to true. When a PV is deleted, the controller only renames the subdirectory in the NAS file system instead of deleting the files. This operation is nearly instantaneous and prevents the task queue from being blocked.
When archiveOnDelete is set to true, the renamed subdirectories are not automatically deleted. You must manage file deletion yourself. Common methods include setting up a scheduled deletion task on a node or launching multiple Pods to concurrently delete subdirectories that follow a specific naming pattern.