The following error is observed when attempting to create a new PVC in a Vanilla CSI (Container Storage Interface) environment:
"Failed to create vSAN file share : The total number of shares reached limit 100."
/opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB -c "select * from cns.volume_info;"Note:
For a vSAN OSA environment, the limit will always be 100.
For a vSAN ESA environment, the limit was increased to 250 from 100 in vSAN 8.0U3, and then was increased to 500 in VCF 9.0.
The corresponding stale CNS resources must be manually identified and corrected in the CNS database to reflect the current state of the environment.
Compare the list of active PVs in your Kubernetes cluster(s) with the list of File Volumes in the vCenter CNS database.
Command: kubectl get pv -A
pvc-aaaaaaaa-####-####-####-############pvc-bbbbbbbb-####-####-####-############pvc-cccccccc-####-####-####-############
Command: /opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB -c "select * from cns.volume_info;"
file:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx pvc-aaaaaaaa-####-####-####-############file:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx pvc-bbbbbbbb-####-####-####-############file:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx pvc-cccccccc-####-####-####-############file:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx pvc-dddddddd-####-####-####-############ (Excess) file:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx pvc-eeeeeeee-####-####-####-############ (Excess)file:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx pvc-ffffffff-####-####-####-############ (Excess)The Excess (Stale) volumes (highlighted) are those that exist in the CNS database but do not have a corresponding PV in the Kubernetes cluster. These are the targets for deletion.
For each identified stale PV, check if any associated VolumeAttachment or Pod still exists.
kubectl get volumeattachment -o wide | grep <stale-pv-name>
# Example: kubectl get volumeattachment -o wide | grep pvc-dddddddd-####-####-####-############
kubectl get pod -n <pod namespace> -o widekubectl describe pod -n <pod namespace> <pod name>WARNING: Deleting a volume is an irreversible process. When setting the deleteDisk parameter to true, the underlying data is permanently destroyed. Ensure you have a current and valid backup of any data residing on the volume before proceeding with deletion.
Use the vSAN MOB to delete the stale volumes from the CNS database.
https://<vCenter-IP-address>/vsan/mob/?moid=cns-volume-manager. <vCenter-IP-address> with your vCenter server's IP address or hostname. cns-volume-managerCnsDeleteVolume methoddeleteDisk parameter to true. Invoke Method to delete the volume.