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 Helm override:
Create an overrides file listing the desired feature gates.
cat <<EOF > /home/sysadmin/kubevirt-overrides.yaml featureGates: - Snapshot - ExpandDisks EOF
Apply the Helm override.
~(keystone_admin)]$ system helm-override-update kubevirt-app kubevirt-app kubevirt --values /home/sysadmin/kubevirt-overrides.yaml
Apply the KubeVirt application.
~(keystone_admin)]$ system application-apply kubevirt-app
Verify that the ExpandDisks feature gate is enabled in the KubeVirt CR.
~(keystone_admin)]$ kubectl get kubevirt kubevirt -n kubevirt -o jsonpath='{.spec.configuration.developerConfiguration.featureGates}' Expected: ["Snapshot","ExpandDisks"]
Expand a PVC Backed Disk from VM¶
Below is an example of how to expand a PVC backed disk from a VM:
Identify the PVC to expand (under
spec.template.spec.domain.devices.disks).kubectl get vm <vm name> -n <namespace> -o yaml
Edit the PVC to expand its size using the kubectl edit pvc <pvc name> -n <namespace> command.
spec: resources: requests: storage: 20Gi # new desired sizeConfirm the change using the kubectl get pvc <pvc name> -n <namespace> command.
Restart VM.
virtctl stop <vm name> virtctl start <vm name>
Resize the filesystem of OS in use inside VM.