Maksym Prokopov personal blog
Idea is a something worth sharing

How to increase Kubernetes PVC size for AWS EBS

12.05.2020

Reading time: 1 min.

It’s quite simple to increase PVC size since K8s 1.11

kubectl describe pvc and find your storage class.

Name: jenkins
Namespace: jenkins
StorageClass: jenkins-gp2
Status: Bound
Volume: pvc-473e3dbf-b759-11e9-9cbc-02a7fb0b6cca
Labels: app.kubernetes.io/component=jenkins-master
app.kubernetes.io/instance=jenkins
app.kubernetes.io/managed-by=Tiller
app.kubernetes.io/name=jenkins
helm.sh/chart=jenkins-1.3.6
Annotations: pv.kubernetes.io/bind-completed: yes
pv.kubernetes.io/bound-by-controller: yes
volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/aws-ebs
Finalizers: [kubernetes.io/pvc-protection]
Capacity: 16Gi
Access Modes: RWO
VolumeMode: Filesystem
Mounted By: jenkins-6b5c9bcbbb-gr2l5
Events:

kubectl edit storageclass jenkins-gp2 add the following to your storage class

allowVolumeExpansion: true

kubectl edit pvc jenkins

Change PVC size

Name: jenkins
Namespace: jenkins
StorageClass: jenkins-gp2
Status: Bound
Volume: pvc-473e3dbf-b759-11e9-9cbc-02a7fb0b6cca
Labels: app.kubernetes.io/component=jenkins-master
app.kubernetes.io/instance=jenkins
app.kubernetes.io/managed-by=Tiller
app.kubernetes.io/name=jenkins
helm.sh/chart=jenkins-1.3.6
Annotations: pv.kubernetes.io/bind-completed: yes
pv.kubernetes.io/bound-by-controller: yes
volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/aws-ebs
Finalizers: [kubernetes.io/pvc-protection]
Capacity: 16Gi <======= this was 8Gi
Access Modes: RWO
VolumeMode: Filesystem
Mounted By: jenkins-6b5c9bcbbb-gr2l5
Events:

Delete pod which is using this PVC

kubectl delete pod jenkins-34252353-2f4gh

After the pod is recreated you’ll see the new size for your PVC!