When attempting to attach or detach a PersistentVolume (PV) to/from a Kubernetes worker node VM using the vSphere CSI driver, pods remain stuck in ContainerCreating or Terminating states.
The following warning events are observed in kubectl describe pod or kubectl get events:
Warning FailedAttachVolume attachdetach-controller
AttachVolume.Attach failed for volume "pvc-uuid" : rpc error: code = Internal desc = failed to attach disk: "disk-uuid" with node: "node-uuid" err failed to attach cns volume: "disk-uuid" to node vm...
fault: (*types.LocalizedMethodFault)... Fault: (*types.ResourceInUse) LocalizedMessage: "The resource 'volume' is in use."Additionally, the vSphere CSI controller logs contain detach failures:
Error processing "csi-uuid": failed to detach: rpc error: code = Internal desc = failed to detach disk: "disk-uuid" from node: "node-uuid" err failed to detach cns volume...
fault: (*types.LocalizedMethodFault)... Fault: (*types.NotFound) LocalizedMessage: "The object or item referred to could not be found."
TCA 3.2
TCP 5.0
vSphere 8.x
This issue occurs due to a desynchronization between the vSphere Cloud Native Storage (CNS) database and the actual virtual disk attachment state. The CNS metadata indicates the volume is still attached to a previous worker node (stale lock), preventing the vSphere CSI driver from reassigning the disk to the new target node.
Log in to the vSphere Client.
Locate the Worker Node VM where the volume was previously attached (refer to the node UUID in the NotFound log).
Right-click the VM > Edit Settings.
Check if the hard disk corresponding to the Persistent Volume ID (disk-uuid) is still attached to the VM.
If present, click the X icon to remove the hard disk (do not delete files from the datastore).
Click OK to save changes.
Identify the failing VolumeAttachment object in the Kubernetes cluster:
kubectl get volumeattachment | grep <pvc-name-or-id>Delete the stuck VolumeAttachment resource:
kubectl delete volumeattachment <volume-attachment-name>Restart the affected pod or trigger a force re-scheduling by scaling down and back up the deployment:
kubectl rollout restart deployment vsphere-csi-controller -n vmware-system-csiIf the volume remains in an inconsistent state in the Cloud Native Storage cache, trigger a CNS resync operation via the vCenter API as outlined in Broadcom KB 383797.
Confirm the volume is successfully attached to the new node and the Pod status transitions to Running.