lokomotive
lokomotive copied to clipboard
AWS EBS CSI Driver volume expansion does not work
AWS EBS CSI Driver volume expansion does not work
I have deployed the CSI driver with the following configuration:
component "aws-ebs-csi-driver" {
enable_default_storage_class = true
enable_volume_scheduling = true
enable_volume_resizing = true
enable_volume_snapshot = true
}
PVC is created by the default storage class ebs-sc
:
$ kubectl get pvc data-prometheus-prometheus-operator-kube-p-prometheus-0 -o yaml | grep storageClass
storageClassName: ebs-sc
But when I try to resize the PVC created by the default storage class I get the following error:
$ kubectl edit pvc data-prometheus-prometheus-operator-kube-p-prometheus-0
error: persistentvolumeclaims "data-prometheus-prometheus-operator-kube-p-prometheus-0"
could not be patched: persistentvolumeclaims "data-prometheus-prometheus-operator-kube-p-prometheus-0"
is forbidden: only dynamically provisioned pvc can be resized and the storageclass that
provisions the pvc must support resize
You can run `kubectl replace -f /tmp/kubectl-edit-mlu5z.yaml` to try this update again.
I changed the size from 100Gi to 200Gi and I saw above error. So it turns out that the storage class is deployed without the field: allowVolumeExpansion: true
despite the lokocfg field enable_volume_resizing
in aws-ebs-csi-driver
.
$ kubectl get sc ebs-sc -o yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
meta.helm.sh/release-name: aws-ebs-csi-driver
meta.helm.sh/release-namespace: kube-system
storageclass.kubernetes.io/is-default-class: "true"
creationTimestamp: "2021-05-06T07:15:01Z"
labels:
app.kubernetes.io/managed-by: Helm
name: ebs-sc
resourceVersion: "1693"
provisioner: ebs.csi.aws.com
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
Found a workaround to fix this manually:
kubectl edit sc ebs-sc
And add this field at the root level: allowVolumeExpansion: true
.
Now try updating the PVC again.