New Pods remain stuck in the Init or ContainerCreating state.
Describing the pod shows the error: "The resource 'volume' is in use."
kubectl describe pod <pod-name> -n <namespace>
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedAttachVolume 43m attachdetach-controller AttachVolume.Attach failed for volume "pvc-########-###-#####-###-#########" : rpc error: code = Internal desc = failed to attach disk: "#########-####-####-####-#######" with node: "workload-###-#-#######-#####" err failed to attach cns volume: "#########-####-####-####-#######" to node vm: "VirtualMachine:vm-###### [VirtualCenterHost: ******, UUID: ########-####-####-####-########, Datacenter: ***** [Datacenter: Datacenter:datacenter-##, VirtualCenterHost: *******]]". fault: "(*types.LocalizedMethodFault)(0xc000a70c60)({\n DynamicData: (types.DynamicData) {\n },\n Fault: (*types.ResourceInUse)(0xc000ede640)({\n VimFault: (types.VimFault) {\n MethodFault: (types.MethodFault) {\n FaultCause: (*types.LocalizedMethodFault)(<nil>),\n FaultMessage: ([]types.LocalizableMessage) <nil>\n }\n },\n Type: (string) \"\",\n Name: (string) (len=6) \"volume\"\n }),\n LocalizedMessage: (string) (len=32) \"The resource 'volume' is in use.\"\n})\n". opId: "086a91d5"
Warning FailedMount 87s (x1769 over 2d18h) kubelet Unable to attach or mount volumes: unmounted volumes=[data], unattached volumes=[data]: timed out waiting for the condition
Logs from the csi-attacher
container show the error 'NoPermission', indicating a permission issue during the volume detach operation.
kubectl logs <csi-controller-pod-name> -n <namespace> -c csi-attacher
I1111 04:45:24.730061 1 controller.go:165] Ignoring VolumeAttachment "csi-##############################################################" change
I1111 04:45:24.730066 1 csi_handler.go:624] Saved detach error to "csi-
##############################################################
"I1111 04:45:24.730097 1 csi_handler.go:231] Error processing "csi-
##############################################################
": failed to detach: rpc error: code = Internal desc = queryVolume failed for volumeID: "########-####-####-####-#########" with err=ServerFaultCode: NoPermission
Tanzu Kubernetes Grid
vSphere with Tanzu.
The issue arises because the TKG role assigned to the TKG user doesn't have sufficient vSphere permissions to detach the virtual disk (VMDK),
causing it to stay connected to the original node rather than detaching as intended.
Ensure that the TKG role has the necessary permissions as outlined in the 'Required Permissions for the vSphere Account' section of the documentation
vSphere Object Permissions Required for Tanzu Kubernetes Grid
vSphere Object |
Required Permissions |
Cns |
- Searchable |
Datastore |
- Allocate space |
Global |
- Disable methods |
Network |
- Assign network |
Profile-driven storage |
- Profile-driven storage view |
Resource |
- Assign virtual machine to resource pool |
Sessions |
- Message |
Virtual machine |
- Change Configuration > Add existing disk |
vApp |
- Import |
Assigning the TKG Role to vSphere Objects
Assign the tkg-user with the TKG role to each of the following vSphere objects involved in your Tanzu Kubernetes Grid deployment:
vSphere Inventory Permissions
Reference Article:
Prepare to Deploy Management Clusters to vSphere