vSphere PVC attachment fails and stays in a Pending state when the region/zone parameters in the vSphere CSI configuration are missing or set to null.
TCA 2.3
TKG 2.x
The secret named xxxx-vsphere-csi-addon in the namespace workload_cluster_namespace within the management cluster had the values null for the region and zone parameters, which caused the pods failure and PVC in the pending state. To determine the root cause why the region and zone parameters in the secret were cleared to value null, consider the following options:
null during upgrade.StorageClasses for non-topology-aware provisioning do not use the allowedTopologies field in the YAML configuration.
Example StorageClass YAML configuration for non-topology aware volume provisioning:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: example-non-topology-aware-sc
provisioner: csi.vsphere.vmware.com
parameters:
datastore: "datastore1"
StorageClasses for Topology-aware provisioning uses the allowedTopologies field in the YAML configuration.
Example StorageClass YAML configuration for Topology aware volume provisioning:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: example-topology-aware-sc
provisioner: csi.vsphere.vmware.com
parameters:
datastore: "datastore1"
allowedTopologies:
- matchLabelExpressions:
- key: failure-domain.beta.kubernetes.io/zone
values:
- zone1
null. While non-topology-aware PV provisioning still functions with a storage class that does not include the allowedTopologies field, topology-aware volume provisioning will face issues. To resolve this, manually set the Zone and Region values in the vSphere CSI addon secret within Kubernetes.null.Workaround:
Update the missing values for the region and zone parameters and the vSphere PVC will enter the bound state, resolving the issue.
kubectl describe pod -A -l app=vsphere-csi-controller | grep -i driver
There are 6 containers running in vsphere-csi-controller pod. csi-provisoner, csi-attacher, csi-external-resizer, vsphere-csi-controller, csi-livenessprobe and vsphere-syncer.
Collect the logs from all containers as per commands below
kubectl logs <Replace with_vsphere-csi-controller-pod_name> -n <replace with actual name space>
kubectl logs <Replace with_vsphere-csi-controller-pod_name> -n <replace with actual name space> --previous
kubectl logs <Replace with_vsphere-csi-controller-pod_name> -n <replace with actual name space> -c vsphere-csi-controller
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c csi-provisoner
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c csi-attacher
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c csi-external-resizer
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c csi-livenessprobe
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c vsphere-syncer
kubectl logs <Replace with_vsphere-csi-controller-pod_name> -n <replace with actual name space> -c vsphere-csi-controller --previous
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c csi-provisoner --previous
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c csi-attacher --previous
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c csi-external-resizer --previous
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c csi-livenessprobe --previous
kubectl logs <Replace with_vsphere-csi-controller-pod-name> -n <replace with actual name space> -c vsphere-syncer --previous
kubectl describe/logs/get of the pod where PV attachment is failing
kubectl describe/logs of the vSphere CSI Node pod from the specific Node the application pod is scheduled (Pod where PV attachment failed)
Kubectl get/describe nodes -A -o wide in workload cluster
kubectl get/describe sc/pv/pvc
kubectl get/describe sc/pv/pvc -o yaml
kubectl get secrets -A grep csi
kubectl get secret workload_cluster_name-vsphere-csi-addon -n name space -o yaml
kubectl get secret workload_cluster_name-vsphere-csi-addon -n name space -o jsonpath={.data. "values\.yaml"} | base64
kubectl get secret vsphere-csi-secret -n name space -o yaml