K8S-VOL-002 kubernetes config_error ai_generated true

Error: volume expansion is not supported for this volume source

ID: kubernetes/volume-expand-error-feature-gate

Also available as: JSON · Markdown · 中文
78%Fix Rate
82%Confidence
1Evidence
2023-09-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
kubernetes 1.21 active
kubernetes 1.22 active
kubernetes 1.24 active
kubernetes 1.26 active

Root Cause

The PersistentVolumeClaim's storage class does not have 'allowVolumeExpansion: true', or the CSI driver does not support online expansion.

generic

中文

PersistentVolumeClaim 的存储类没有设置 'allowVolumeExpansion: true',或者 CSI 驱动程序不支持在线扩展。

Official Documentation

https://kubernetes.io/docs/concepts/storage/persistent-volumes/#expanding-persistent-volumes-claims

Workarounds

  1. 85% success Patch the storage class to enable expansion: `kubectl patch storageclass <storage-class-name> -p '{"allowVolumeExpansion": true}'`. Then retry the PVC resize.
    Patch the storage class to enable expansion: `kubectl patch storageclass <storage-class-name> -p '{"allowVolumeExpansion": true}'`. Then retry the PVC resize.
  2. 70% success If the CSI driver does not support expansion, migrate to a different storage class that supports it, or use a StatefulSet with a new PVC and copy data manually.
    If the CSI driver does not support expansion, migrate to a different storage class that supports it, or use a StatefulSet with a new PVC and copy data manually.

中文步骤

  1. 修补存储类以启用扩展:`kubectl patch storageclass <storage-class-name> -p '{"allowVolumeExpansion": true}'`。然后重试 PVC 大小调整。
  2. 如果 CSI 驱动程序不支持扩展,请迁移到支持扩展的其他存储类,或使用带有新 PVC 的 StatefulSet 并手动复制数据。

Dead Ends

Common approaches that don't work:

  1. Manually edit the PVC spec to increase size without checking the storage class. 90% fail

    The controller will reject the request because the storage class does not allow expansion; the PVC will remain unchanged.

  2. Delete and recreate the PVC with a larger size. 75% fail

    This destroys the existing data unless you have a backup, and it does not enable expansion for future use.