Enable Disk Expansion

For storage methods such as RBD or CephFS, Kubernetes supports expanding storage in-use (allowVolumeExpansion feature). With the ExpandDisks feature, KubeVirt can make additional storage available for the virtual machines. This feature is currently disabled by default and requires enabling a feature gate. To enable it, add the ExpandDisks feature gate in the Kubevirt object by applying the following manifest:

apiVersion: kubevirt.io/v1
kind: KubeVirt
metadata:
  name: kubevirt
  namespace: kubevirt
spec:
  configuration:
    developerConfiguration:
      featureGates:
        - Snapshot
        - ExpandDisks

Expand a PVC Backed Disk from VM

Below is an example of how to expand a PVC backed disk from a VM:

  1. Identify the PVC to expand (under spec.template.spec.domain.devices.disks).

    kubectl get vm <vm name> -n <namespace> -o yaml
    
  2. Edit the PVC to expand its size using the kubectl edit pvc <pvc name> -n <namespace> command.

    spec:
      resources:
        requests:
          storage: 20Gi   # new desired size
    

    Confirm the change using the kubectl get pvc <pvc name> -n <namespace> command.

  3. Restart VM.

    virtctl stop  <vm name>
    virtctl start <vm name>
    
  4. Resize the filesystem of OS in use inside VM.