Reduce kubernetes Persistent Volumes

1/6/2020

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.

-- Shiva
devops
docker
kubernetes

1 Answer

1/6/2020

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

-- Suresh Vishnoi
Source: StackOverflow