In vCenter Server, vslm.vcenter.VStorageObjectManager.deleteVStorageObjectEx.label tasks are failing, and below entries related to the affected Persistent Volume Claims (PVCs) are observed in /var/log/vsan-health/vsanvcmgmtd.log
YYYY-MM-DDTHH:MM:SSZ info vsanvcmgmtd[11049] [vSAN@6876 sub=CnsVolMgr opId=0cad3899] CNS: UpdateVolumeMetadata with spec: (vim.cns.VolumeMetadataUpdateSpec) [--> (vim.cns.VolumeMetadataUpdateSpec) {--> volumeId = (vim.cns.VolumeId) {--> id = "#########"--> },--> metadata = (vim.cns.VolumeMetadata) {--> containerCluster = (vim.cns.ContainerCluster) {--> clusterType = "KUBERNETES",--> clusterId = "######",--> vSphereUser = "######",--> clusterFlavor = "VANILLA",--> },--> entityMetadata = (vim.cns.EntityMetadata) [--> (vim.cns.KubernetesEntityMetadata) {--> entityName = "pvc-#####-#####-#####-#####-######",--> clusterId = "######",--> entityType = "PERSISTENT_VOLUME",--> }--> ],--> containerClusterArray = (vim.cns.ContainerCluster) [--> (vim.cns.ContainerCluster) {--> clusterType = "KUBERNETES",--> clusterId = "#####",--> vSphereUser = "########",--> clusterFlavor = "VANILLA",--> }--> ]
VMware vCenter Server 7.x
VMware vCenter Server 8.x
This typically occurs when the PVC is still being referenced by Kubernetes workloads or is in use by running pods, preventing the deletion operation from proceeding.
To resolve this issue, follow these steps:
kubectl get pods -n <namespace> -o json | jq '.items[] | select(.spec.volumes[].persistentVolumeClaim.claimName=="<pvclaimname>") | .metadata.name'
2. Check for PVC references in Deployments, StatefulSets, or DaemonSets:
kubectl get deployments,statefulsets,daemonsets -n <namespace> -o yaml | grep -B 5 -A 5 "claimName: <pvclaimname>"
3. Delete the PVC if it is no longer in use:
kubectl delete pvc <pvcname> -n <namespace>
Ensure that all references to the PVC are removed in your Kubernetes environment to allow for successful deletion.