How to shrink a PVC (without downtime)

Hi,

I am using glusterfs as storage.

Here is my storage class:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: standard
provisioner: kubernetes.io/glusterfs
parameters:
  resturl: "http://192.168.198.135:8080"
  restauthenabled: "false"
  restuser: "notusedyet"
  restuserkey: "notusedyet"
  volumetype: replicate:2
allowVolumeExpansion: true

I created a pvc of 10Gi, but I am not using much of it. So I wanted to shrink it. If I update the pvc I get following error:

The PersistentVolumeClaim "poc-redis" is invalid: spec.resources.requests.storage: Forbidden: field can not be less than previous value

So what options do I have to shrink this volume? Are there any ways with or without downtime are available? (better without downtime)

In worst case: is there a way to clone a volume to a new one which is smaller?

Thanks, Andreas

There is no method of shrinking volumes directly. You could probably remove the volume from Kubernetes and shrink it outside of it (if gluster supports it) and then map it back in as a new volume, or clone/shrink and remount.