Creating virtual machines with VPC File Storage
Virtual Private Cloud 4.17 and later Bare metal worker nodes only RHCOS only
Use File Storage for VPC to provision persistent storage for virtual machines that run on OpenShift Virtualization.
This topic describes how to verify your environment, create a virtual machine that uses VPC File Storage, and validate that the virtual machine starts successfully.
Before you begin
Before you create a virtual machine with VPC File Storage, complete the following tasks:
- Create a VPC cluster with bare metal worker nodes that uses Red Hat CoreOS (RHCOS). For more information, see Creating VPC clusters.
- Review the planning guidance in Planning your OpenShift Virtualization deployment.
- Configure VPC File Storage as described in Setting up storage for OpenShift Virtualization.
- Install the OpenShift Virtualization Operator as described in Installing the OpenShift Virtualization Operator.
- Install the
virtctlCLI. For more information, see Getting started with OpenShift Virtualization CLI tools.
Verifying your environment
Verify that your cluster is ready before you create a virtual machine.
-
Confirm that the OpenShift Virtualization components are deployed.
oc get hyperconverged -n openshift-cnv oc get pods -n openshift-cnvLook for the
PHASEvalueDeployedin the HyperConverged output. In the pod output, verify that the virtualization pods showRunningorCompletedstatus and that they are not stuck inPending,CrashLoopBackOff, orError. -
Confirm that the VPC File CSI driver add-on is installed.
ibmcloud ks cluster addon ls -c <cluster-name> | grep vpc-file-csi-driverLook for the
vpc-file-csi-driveradd-on in the output and verify that its health state isnormalor that the status indicates that the add-on is ready. -
Verify that a VPC File Storage class is available.
oc get storageclass | grep vpc-fileLook for storage classes such as
ibmc-vpc-file-1000-iopsoribmc-vpc-file-6000-iops. Note the storage class name that you want to use in the later steps. -
Verify that the storage profile for your selected VPC File Storage class is configured with
ReadWriteManyaccess mode andFilesystemvolume mode.oc get storageprofile <storage-class-name> -o yamlIn the output, look for
claimPropertySetsunderspec. Verify thataccessModesincludesReadWriteManyand thatvolumeModeis set toFilesystem.claimPropertySets: - accessModes: - ReadWriteMany volumeMode: Filesystem -
Verify that the selected storage class can provision a persistent volume claim.
cat <<EOF | oc apply -f - apiVersion: v1 kind: PersistentVolumeClaim metadata: name: vpc-file-test-pvc spec: accessModes: - ReadWriteMany resources: requests: storage: 10Gi storageClassName: <storage-class-name> EOF -
Confirm that the test persistent volume claim is bound.
oc get pvc vpc-file-test-pvcIn the output, look for the
STATUScolumn and verify that the persistent volume claim showsBound. If the claim remains inPending, the storage class or storage profile is not configured correctly. -
Review the persistent volume claim details if the claim does not bind.
oc describe pvc vpc-file-test-pvc -
Delete the test persistent volume claim.
oc delete pvc vpc-file-test-pvc
Creating a virtual machine from the web console
Use the OpenShift web console to create a virtual machine that stores its disk on VPC File Storage.
- Log in to the OpenShift web console for your cluster.
- In the navigation menu, click Virtualization > VirtualMachines.
- Click Create and select a template or select From YAML if you want to define the virtual machine manually.
- Enter a name for the virtual machine.
- Select the project where you want to create the virtual machine.
- In the storage section, select a VPC File Storage class such as
ibmc-vpc-file-1000-iopsoribmc-vpc-file-6000-iops. - Set the disk size based on your workload requirements.
- Review the CPU and memory settings, then update them as needed.
- Click Create VirtualMachine.
- In the virtual machine details page, review the Disks, Network interfaces, and Configuration tabs to confirm that the virtual machine was created with the expected settings.
After the virtual machine is created, the console creates the associated persistent volume claim and data volume resources.
Creating a virtual machine from the CLI
Use the CLI if you want to create a virtual machine from a reusable manifest.
-
Create a namespace for your virtual machine workloads if you do not already have one.
oc create namespace vm-project -
Create a virtual machine manifest that references a VPC File Storage class.
cat <<EOF | oc apply -f - apiVersion: kubevirt.io/v1 kind: VirtualMachine metadata: name: rhel9-vm namespace: vm-project spec: running: false template: metadata: labels: kubevirt.io/domain: rhel9-vm spec: domain: cpu: cores: 2 devices: disks: - disk: bus: virtio name: rootdisk - disk: bus: virtio name: cloudinitdisk resources: requests: memory: 4Gi volumes: - dataVolume: name: rhel9-vm-rootdisk name: rootdisk - cloudInitNoCloud: userData: | #cloud-config user: cloud-user password: changeme chpasswd: { expire: false } name: cloudinitdisk dataVolumeTemplates: - metadata: name: rhel9-vm-rootdisk spec: pvc: accessModes: - ReadWriteMany resources: requests: storage: 40Gi storageClassName: <storage-class-name> volumeMode: Filesystem source: blank: {} EOF -
Verify that the virtual machine and data volume resources were created.
oc get vm -n vm-project oc get dv -n vm-project oc get pvc -n vm-projectIn the output, verify that the virtual machine
rhel9-vmis listed, that the data volumerhel9-vm-rootdiskexists, and that the persistent volume claimrhel9-vm-rootdiskis created. If the persistent volume claim is not yetBound, wait for provisioning to complete before you continue. -
Review the data volume details if the data volume is not ready.
oc describe dv rhel9-vm-rootdisk -n vm-project oc describe pvc rhel9-vm-rootdisk -n vm-project -
Start the virtual machine.
virtctl start rhel9-vm -n vm-project -
Verify that the virtual machine instance is running.
oc get vmi -n vm-projectIn the output, look for the virtual machine instance name and verify that its phase is
Running. If no virtual machine instance is listed, review the virtual machine status.oc get vm rhel9-vm -n vm-project -o yaml
Validating the virtual machine
After you create the virtual machine, validate that the storage and compute resources are working as expected.
-
Confirm that the persistent volume claim is bound.
oc get pvc -n vm-projectIn the output, look for the persistent volume claim
rhel9-vm-rootdiskand verify that theSTATUScolumn showsBound. -
Confirm that the data volume import or provisioning completed successfully.
oc get dv -n vm-projectIn the output, verify that the data volume shows a successful phase such as
SucceededorReady, depending on your environment. If the data volume is not ready, review the data volume and persistent volume claim events.oc describe dv rhel9-vm-rootdisk -n vm-project oc describe pvc rhel9-vm-rootdisk -n vm-project -
Confirm that the virtual machine instance is running.
oc get vmi -n vm-project -
Review the virtual machine instance details to confirm the node placement, interfaces, and attached volumes.
oc describe vmi rhel9-vm -n vm-project -
If you configured cloud-init credentials, connect to the virtual machine console.
virtctl console rhel9-vm -n vm-project -
Review the virtual machine details if the instance does not start.
oc describe vm rhel9-vm -n vm-project oc describe vmi rhel9-vm -n vm-project
Understanding limitations and considerations
Review the following considerations when you use VPC File Storage for virtual machines:
- VPC File Storage performance
- VPC File Storage is a network-attached storage option. It is generally best suited for development, test, and lower-I/O workloads.
- Snapshots and cloning
- Snapshot and cloning support differs from OpenShift Data Foundation. Review your storage requirements before you standardize on VPC File Storage for production workloads.
- Live migration
- Live migration is supported when the storage profile is configured correctly and the workload meets the OpenShift Virtualization requirements.
- Storage profile configuration
- You must configure the storage profile for the VPC File CSI provisioner so that CDI can use the storage class correctly.
Troubleshooting
If the virtual machine does not start or the disk is not provisioned correctly, review the following topics:
Next steps
After you create a virtual machine with VPC File Storage: