Troubleshooting Volume Mounts
Storage issues are among the most common problems in Kubernetes. This lesson covers how to diagnose and resolve mount errors, permission issues, and pending PVC states.
PVC Stuck in Pending
A PVC in Pending status means no PV can satisfy the claim.
kubectl get pvc
kubectl describe pvc my-claim
Check the Events section in the describe output. Common causes:
- No PV matches the requested size or access mode
- The specified StorageClass does not exist
- The provisioner cannot create storage (quota exceeded, permissions)
# Verify available PVs
kubectl get pv
# Check StorageClass exists
kubectl get sc
Mount Errors in Pods
When a pod fails to start due to volume issues, check the pod events:
kubectl describe pod my-pod
kubectl get events --field-selector involvedObject.name=my-pod
Common mount errors include:
- MountVolume.SetUp failed -- the volume could not be mounted to the node
- FailedAttachVolume -- the cloud disk could not be attached (often already attached to another node)
- FailedMount timeout -- the node timed out waiting for the volume
Permission Issues
If your container cannot write to a mounted volume:
kubectl exec -it my-pod -- ls -la /data
kubectl exec -it my-pod -- id
Fix permissions using a securityContext:
spec:
securityContext:
fsGroup: 1000
containers:
- name: app
image: myapp
securityContext:
runAsUser: 1000
Multi-Attach Errors
Volumes with ReadWriteOnce access mode can only attach to one node. If a pod is rescheduled, the old volume attachment may linger:
kubectl get volumeattachments
kubectl delete pod stuck-pod --grace-period=0 --force