Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce kubernetes Persistent Volumes

I am using multiple apps on kubernetes and all are configured with pd-ssd volume. Some deployments are running on big volume with less data. So i wanted to reduce that volume of the pods. I have worked with increase volumen and it was worked. But i can't reduce the space of the volume.

Steps i did. Current size is 100Gi, I want to resize it to 30Gi.

  1. Scaling down the application and pod.
  2. edit pvc to reduce the size of volume.
k edit pvc my-pvc

I got the following error when I save the changes.

error: persistentvolumeclaims "my-pvc" is invalid A copy of your changes has been stored to "/tmp/kubectl-edit-4ivk1.yaml" error: Edit cancelled, no valid changes were saved.

But i can not able to save the changes for reduce volume size.

like image 316
Shiva Avatar asked May 21 '26 03:05

Shiva


1 Answers

Shrinking persistent volumes is not supported in kubernetes, you can only increase it. resizing-persistent-volumes-using-kubernetes

like image 170
Suresh Vishnoi Avatar answered May 22 '26 18:05

Suresh Vishnoi