Cannot create a GlusterFS PersistentVolumeClaim
Cannot create a GlusterFS PersistentVolumeClaim (PVC).
Causes
The PVC name is too long. You cannot bind a PVC service endpoint if its name is longer than 63 characters. When GlusterFS creates a service endpoint name, it adds glusterfs-dynamic to the PVC name, and these extra characters can cause
the PVC name to exceed the limit.
For example, when you create a PVC in a StatefulSet by using volumeClaimTemplates, the PVC that is created automatically is named <pvc name>-<statefulset name>-<ordinal>. For example, if both the PVC and
the StatefulSet are named default-mq-stocktrader-m, the new PVC might be named default-mq-stocktrader-m-default-mq-stocktrader-m-0. If you use GlusterFS to create this PVC, the glusterfs-dynamic- prefix is
added to the PVC name to create a service endpoint. The service endpoint name glusterfs-dynamic-default-mq-stocktrader-m-default-mq-stocktrader-m-0 exceeds 63 characters, and the PVC bind fails.
When you create the PVC, you might see Status: Pending. You might also see a message similar to the following message in the Events: section of the command output.
Service "glusterfs-dynamic-default-mq-stocktrader-m-default-mq-stocktrader-m-0" is invalid: \
metadata.name: Invalid value: \
"glusterfs-dynamic-default-mq-stocktrader-m-default-mq-stocktrader-m-0": \
must be no more than 63 characters
Resolving the problem
If you use GlusterFS, limit your PVC name to 45 characters. If you use volumeClaimTemplates in StatefulSets, use short names for both the StatefulSet name and PVC name.
If your PVC binding fails, reduce the length of the StatefulSet name or PVC name so that the total length of the GlusterFS service endpoint, glusterfs-dynamic-<pvc name>-<statefulset name>-<ordinal>, does not exceed
63 characters.
For more information about this issue, see the glusterfs create pvc failed issue in the Kubernetes community.