# persistentvolumeclaim is stuck in Pending state: no storage class specified

- **ID:** `kubernetes/persistentvolumeclaim-stuck-pending-no-storageclass`
- **Domain:** kubernetes
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 88%

## Root Cause

A PersistentVolumeClaim (PVC) is stuck in Pending state because it doesn't specify a storageClassName and the cluster has no default StorageClass configured.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Kubernetes v1.26.6 | active | — | — |
| Kubernetes v1.27.4 | active | — | — |
| Kubernetes v1.28.1 | active | — | — |

## Workarounds

1. **Check existing StorageClasses: `kubectl get storageclass`. If none is set as default, set one: `kubectl patch storageclass <name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'`** (85% success)
   ```
   Check existing StorageClasses: `kubectl get storageclass`. If none is set as default, set one: `kubectl patch storageclass <name> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'`
   ```
2. **Update the PVC to specify an existing storage class: `kubectl edit pvc <pvc-name>` and add `spec.storageClassName: <existing-class-name>`** (90% success)
   ```
   Update the PVC to specify an existing storage class: `kubectl edit pvc <pvc-name>` and add `spec.storageClassName: <existing-class-name>`
   ```

## Dead Ends

- **Manually create a PersistentVolume (PV) with the same size** — Without a storage class, the PVC won't bind to a manually created PV unless the PV has the exact same label and access modes, and the PVC doesn't specify a selector. It's easier to configure a StorageClass. (75% fail)
- **Delete and recreate the PVC with a random storageClassName** — Using a random or non-existent storage class name will still result in Pending state. The storage class must exist and be configured correctly. (90% fail)
