Troubleshoot storage exceptions
If a Pod is in an abnormal state when you mount or use a volume, check the states and events of the Pod and PersistentVolumeClaim (PVC). Then check the Container Storage Interface (CSI) add-on. Follow the procedures and FAQ answers to identify the cause and resolve the issue.

1. Check whether the abnormal Pod state is caused by a storage issue
Use the events of the Pod or PVC to confirm that the Pod fails to start because of a storage issue.
-
View the events of the abnormal Pod.
kubectl describe pod <pod-name>-
If a related event in Events indicates a storage issue (for example, the
FailedSchedulingevent in the sample, whoseMessageindicates that scheduling failed because the volume does not match the node), continue troubleshooting as described below.Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedScheduling 4m37s default-scheduler 0/1 nodes are available: 1 node(s) had volume node affinity conflict. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling., -
If Events show that the volume is already mounted, such as the
SuccessfulAttachVolumeevent in the sample, a Pod that still fails to start is not a storage issue. If the Pod is inCrashLoopBackOffafter the attach succeeded, troubleshoot other issues based on Events.Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 97s default-scheduler Successfully assigned default/disk-test-0 to cn-shanghai.192.168.5.2 Normal SuccessfulAttachVolume 97s attachdetach-controller AttachVolume.Attach succeeded for volume "d-uf6b8s2l5ypf48*****"
-
-
If no storage-related events appear in the Pod events, view all events.
kubectl get events-
If a related event in Events indicates a storage issue (for example,
FailedBindingin the sample indicates that the PVC failed to bind to the PersistentVolume, continue troubleshooting as described below.LAST SEEN TYPE REASON OBJECT MESSAGE 2m56s Normal FailedBinding persistentvolumeclaim/data-my-release-mariadb-0 no persistent volumes available for this claim and no storage class is set 41s Normal ExternalProvisioning persistentvolumeclaim/pvc-nas-dynamic-create-subpath8 waiting for a volume to be created, either by external provisioner "nasplugin.csi.alibabacloud.com" or manually created by system administrator 3m31s Normal Provisioning persistentvolumeclaim/pvc-nas-dynamic-create-subpath8 External provisioner is provisioning volume for claim "default/pvc-nas-dynamic-create-subpath8" -
If Events contains no storage-related events, troubleshoot other issues based on Events.
-
2. Check whether the storage add-on works properly
If your cluster uses the Flexvolume add-on, migrate to the CSI add-on as soon as possible because Flexvolume is deprecated. For more information, see Upgrade from FlexVolume to CSI.
-
Check whether the CSI add-on works properly.
kubectl get pod -n kube-system |grep csiA sample response is as follows. If the Pod is not in the Running state, run
kubectl describe pods <pod-name> -n kube-systemto view the specific reason why the container exited and the events of the Pod.The CSI add-on consists of csi-plugin and csi-provisioner. The managed version of csi-provisioner is installed by default. Managed add-ons are maintained by Alibaba Cloud, and you cannot see the related Pods in your cluster.
NAME READY STATUS RESTARTS AGE csi-plugin-bpz28 4/4 Running 0 3d csi-plugin-h2tdg 4/4 Running 0 3d csi-plugin-qpnm4 4/4 Running 0 3d csi-plugin-wczgm 4/4 Running 0 3d -
Check whether the CSI add-on is the latest version.
kubectl get ds csi-plugin -n kube-system -o yaml |grep imageConfirm the image version in the
imagefield of the returned information. Example:image: registry-cn-shanghai-vpc.ack.aliyuncs.com/acs/csi-plugin:v1.33.1-67e8986-aliyunIf the storage add-on is not the latest version, see Upgrade CSI components. For information about the latest version of the storage add-on, see csi-plugin.
Alternatively, go to the Add-ons page in the console, find the csi-plugin and csi-provisioner add-ons, check the version information, and upgrade the add-ons.
-
Check the YAML of the PersistentVolume (PV), PVC, and StorageClass. Confirm that the driver configuration (the
driverorprovisionerfield) specifies the CSI add-on and matches the storage add-on used by the current cluster.
3. Check whether the PVC is in the Bound state
-
View the state of the PVC.
kubectl get pvc -
If the PVC is not in the Bound state, troubleshoot the issue by using the following methods:
Cause
-
Static: This issue occurs because the Selectors of the PVC and the PV do not meet the conditions for binding to each other. For example, the Selector configured in the PVC is inconsistent with the one in the PV, the StorageClass Name is inconsistent, or the PV is in the Released state.
-
Dynamic: A problem with the csi-provisioner add-on prevents the PVC from binding.
Solutions
-
Static: Check whether the related YAML is written correctly. See the following topics:
NoteIf the PV is in the Released state, the PV cannot be reused. Get the information about the storage resource from the PV, and then recreate the PV.
-
Dynamic: Run
kubectl describe pvc <pvc-name> -n <namespace>to view the events of the PVC. Handle the issue based on the event messages. The solutions are as follows: -
If you use a cloud disk volume, an issue may have occurred when the Elastic Compute Service (ECS) OpenAPI created the cloud disk. See ECS Error Center to troubleshoot the issue.
-
4. Check whether the Pod is in the Running state
-
View the state of the Pod.
kubectl get pod -
If the PVC is in the Bound state and the Pod is not in the Running state, troubleshoot the issue based on the volume type using the following methods:
Cloud Disk Volume
ImportantWhen you use a cloud disk volume, make sure that the instance type of the ECS node where the Pod is scheduled supports mounting this type of cloud disk. The Pod and the cloud disk must be in the same zone of the same region. For information about the mapping between cloud disk types and ECS instance types, see Instance family overview.
Cause
-
No node that meets the conditions is available for scheduling.
-
An issue occurred when the cloud disk was mounted.
-
The ECS node and the cloud disk type do not match.
Solutions
-
Schedule the Pod to another node to recover quickly. For more information, see Schedule an application to a specified node.
-
Run
kubectl describe pods <pod-name>to view the events of the Pod. Handle the issue based on the event messages. For solutions, see Disk volume FAQ. -
If the issue is caused by a mismatch between the ECS node and the cloud disk type, select a cloud disk of a suitable type. For more information, see Instance family overview.
-
For solutions to other ECS OpenAPI issues, see ErrorCode.
File Storage NAS Volume
Important-
The node and NAS must be in the same Virtual Private Cloud (VPC). If they are not in the same VPC, use Cloud Enterprise Network (CEN) to connect them.
-
NAS supports mounting across zones.
-
The mount directory of Extreme NAS must start with
/share.
Cause
-
When the NAS volume was mounted,
fsGroupwas set, and the chmod operation is slow because the volume contains many files. -
Port 2049 is restricted in the security group, which prevents NAS from being mounted.
-
NAS and the node are not in the same VPC.
Solutions
-
Check whether
fsGroupis configured. If it is, remove it, restart the Pod, and mount the volume again. -
Check whether port 2049 is restricted on the node to which the Pod is scheduled. If the port is restricted, allow port 2049 and then mount the volume again. For more information, see Add a security group rule.
-
Make sure that NAS and the node are in the same VPC. If they are not in the same VPC, use Cloud Enterprise Network (CEN) to connect them.
-
For other issues, run
kubectl describe pods <pod-name>to view the events of the Pod. Handle the issue based on the event messages. For solutions, see NAS volume FAQ.
Object Storage Service (OSS) Volume
Important-
When a node mounts OSS, you must specify the AccessKey information in the PV, and the AccessKey information can be provided by using a Secret.
-
When you use OSS across regions, you must change the bucket URL to a public endpoint. (Recommended) Use an internal endpoint within the same region.
Cause
-
When the OSS volume was mounted,
fsGroupwas set, and the chmod operation is slow because the volume contains many files. -
An internal endpoint was used across regions, which makes the bucket endpoint unreachable.
Solutions
-
Check whether
fsGroupis configured. If it is, remove it, restart the Pod, and mount the volume again. -
Check whether you access the bucket across regions by using an internal endpoint. If so, use a public endpoint instead.
-
For other issues, run
kubectl describe pods <pod-name>to view the events of the Pod. Handle the issue based on the event messages. For solutions, see FAQ for ossfs 1.0 volumes or ossfs 2.0 persistent volume FAQ.
-
FAQ
When you create or mount a volume, the PVC reports no volume plugin matched
Symptom
When you create or mount a volume, the PVC reports Unable to attach or mount volumes: unmounted volumes=[xxx], unattached volumes=[xxx]: failed to get Plugin from volumeSpec for volume "xxx" err=no volume plugin matched.
Cause
The storage add-on does not match the YAML template. When you create or mount a volume, the corresponding storage add-on cannot be found.
Solutions
Check whether the storage add-on exists in the cluster.
-
If the storage add-on is not installed, install it. For more information, see Manage components.
-
If the storage add-on is installed, check whether the storage add-on matches the YAML templates of the PV and PVC and meets the following conditions:
-
The CSI add-on is deployed by using the CSI-related documentation. For more information, see Storage CSI.
-
The Flexvolume add-on is deployed by using the Flexvolume-related documentation. For more information, see Storage Flexvolume.
ImportantBecause Flexvolume is deprecated, it is recommended that you migrate to the CSI add-on as soon as possible. For more information, see Upgrade from FlexVolume to CSI.
-
The Pod event reports 0/x nodes are available: x pod has unbound immediate PersistentVolumeClaims
Symptom
The Pod fails to start, and the Pod event reports the following message:
0/x nodes are available: x pod has unbound immediate PersistentVolumeClaims. preemption: 0/x nodes are available: x Preemption is not helpful for scheduling
Cause
The custom StorageClass referenced by the Pod was not created, so it cannot be found.
Solutions
Check whether the StorageClass referenced by the current Pod exists. If it does not exist, recreate the StorageClass.
The PV is in the Released state and cannot be bound by recreating the PVC
Symptom
After the PVC is deleted by mistake, the PV is in the Released state and cannot be bound by recreating the PVC.
Cause
If the reclaimPolicy of the PVC is Retain, the PV changes to the Released state when the PVC is deleted by mistake.
Solutions
Delete the pv.spec.claimRef field in the current PV and then bind it again by using the static volume method. This changes the PV to the Bound state.
The PV is in the Lost state and cannot be bound by recreating the PVC
Symptom
After the PVC and PV are created, the PV is in the Lost state and cannot be bound to the PVC.
Cause
The PVC name referenced by the claimRef in the PV does not exist, which causes the PV to be in the Lost state.
Solutions
Delete the pv.spec.claimRef field in the current PV and then bind it again by using the static volume method. This changes the PV to the Bound state.
Do StorageClass changes affect existing storage?
If the YAML files of the PVC and PV do not change, changes to the StorageClass do not affect existing storage. For example, when you modify the ALLOWVOLUMEEXPANSION field of the StorageClass, the change takes effect only after you modify the Capacity of the PVC. If the YAML file of the PVC does not change, this field does not affect the existing configuration.