This topic provides answers to some frequently asked questions about Object Storage Service (OSS) volumes.

Why does it require a long time to mount an OSS volume?

Symptom:

It requires a long time to mount an OSS volume.

Cause:

If the following conditions are met, kubelet performs the chmod or chown operation when volumes are mounted, which increases the time consumption.

  • The AccessModes parameter is set to ReadWriteOnce in the PV and PVC templates.
  • The securityContext.fsgroup parameter is set in the application template.

Solution:

  • If the securityContext.fsgroup parameter is set in the application template, delete the fsgroup parameter in the securityContext section.
  • If you want to configure the user ID (UID) and mode of the files in the mounted directory, you can manually mount the OSS bucket to an Elastic Compute Service (ECS) instance. You can then perform chown and chmod operations through a CLI and provision the OSS volume through the CSI plug-in. For more information about how to provision OSS volumes through the CSI plug-in, see Mount a statically provisioned OSS volume.
  • Apart from the preceding methods, for clusters of Kubernetes 1.20 or later, you can set the fsGroupChangePolicy parameter to OnRootMismatch. This way, the chmod or chown operation is performed only during the first-time launch of the pod that uses the volume. This reduces the time to mount new OSS volumes to the pod. For more information about fsGroupChangePolicy, see Set the security context for a container.