ephemeral
You create virtual machines (VMs) by using the OpenShift Container Platform web console or from the command line.
|
Do not create virtual machines in the default |
You create a virtual machine (VM) from a template or instance type by using the OpenShift Container Platform web console.
|
Due to differences in storage behavior, some virtual machine templates are incompatible with single-node OpenShift. To ensure compatibility, do not set the |
You can expedite VM creation by using templates that have an available boot source. VM templates with a boot source are labeled Available boot source if they do not have a custom label.
Templates without a boot source are labeled Boot source required. You can use these templates if you complete the steps for adding a boot source to the virtual machine.
You can create a virtual machine (VM) from a template with an available boot source by using the OpenShift Container Platform web console.
Navigate to Virtualization → Catalog in the web console.
Click Boot source available to filter templates with boot sources.
The catalog displays the default templates. Click All Items to view all available templates for your filters.
Click a template tile to view its details.
Click Quick create VirtualMachine to create a VM from the template.
Optional: Update template or VM parameters:
Click Customize VirtualMachine.
Edit template parameters such as the disk source or VM name.
Click Next.
Edit VM parameters such as network interfaces or disks.
Click Create VirtualMachine.
The VirtualMachine details page displays the provisioning status.
|
See storage volume types and storage fields for details about disk sources. |
| Type | Description | ||
|---|---|---|---|
ephemeral |
A local copy-on-write (COW) image that uses a network volume as a read-only backing store. The backing volume must be a PersistentVolumeClaim. The ephemeral image is created when the virtual machine starts and stores all writes locally. The ephemeral image is discarded when the virtual machine is stopped, restarted, or deleted. The backing volume (PVC) is not mutated in any way. |
||
persistentVolumeClaim |
Attaches an available PV to a virtual machine. Attaching a PV allows for the virtual machine data to persist between sessions. Importing an existing virtual machine disk into a PVC by using CDI and attaching the PVC to a virtual machine instance is the recommended method for importing existing virtual machines into OpenShift Container Platform. There are some requirements for the disk to be used within a PVC. |
||
dataVolume |
Data volumes build on the Specify |
||
cloudInitNoCloud |
Attaches a disk that contains the referenced cloud-init NoCloud data source, providing user data and metadata to the virtual machine. A cloud-init installation is required inside the virtual machine disk. |
||
containerDisk |
References an image, such as a virtual machine disk, that is stored in the container image registry. The image is pulled from the registry and attached to the virtual machine as a disk when the virtual machine is launched. A Only RAW and QCOW2 formats are supported disk types for the container image registry. QCOW2 is recommended for reduced image size.
|
||
emptyDisk |
Creates an additional sparse QCOW2 disk that is tied to the life-cycle of the virtual machine interface. The data survives guest-initiated reboots in the virtual machine but is discarded when the virtual machine stops or is restarted from the web console. The empty disk is used to store application dependencies and data that otherwise exceeds the limited temporary file system of an ephemeral disk. The disk capacity size must also be provided. |
| Field | Description |
|---|---|
Blank (creates PVC) |
Create an empty disk. |
Import via URL (creates PVC) |
Import content via URL (HTTP or HTTPS endpoint). |
Use an existing PVC |
Use a PVC that is already available in the cluster. |
Clone existing PVC (creates PVC) |
Select an existing PVC available in the cluster and clone it. |
Import via Registry (creates PVC) |
Import content via container registry. |
Container (ephemeral) |
Upload content from a container located in a registry accessible from the cluster. The container disk should be used only for read-only filesystems such as CD-ROMs or temporary virtual machines. |
Name |
Name of the disk. The name can contain lowercase letters ( |
Size |
Size of the disk in GiB. |
Type |
Type of disk. Example: Disk or CD-ROM |
Interface |
Type of disk device. Supported interfaces are virtIO, SATA, and SCSI. |
Storage Class |
The storage class that is used to create the disk. |
The following advanced storage settings are optional and available for Blank, Import via URL, and Clone existing PVC disks.
If you do not specify these parameters, the system uses the default storage profile values.
| Parameter | Option | Parameter description | |
|---|---|---|---|
Volume Mode |
Filesystem |
Stores the virtual disk on a file system-based volume. |
|
Block |
Stores the virtual disk directly on the block volume. Only use |
||
Access Mode |
ReadWriteOnce (RWO) |
Volume can be mounted as read-write by a single node. |
|
ReadWriteMany (RWX) |
Volume can be mounted as read-write by many nodes at one time.
|
You create a virtual machine (VM) from an instance type by using the OpenShift Container Platform web console.
|
Creating a virtual machine from an instance type is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope. |
In the web console, navigate to Virtualization → Catalog and click the InstanceTypes tab.
Select a bootable volume.
|
The volume table only lists volumes in the |
Click an instance type tile and select the configuration appropriate for your workload.
Optional: Expand Advanced settings to add a static public SSH key to the VM.
Click Create VirtualMachine.
After the VM is created, you can monitor the status on the VirtualMachine details page.
You can create a virtual machine (VM) by using the command line.
Edit the VirtualMachine manifest for your VM. The following example configures a Red Hat Enterprise Linux (RHEL) VM:
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
labels:
app: <vm_name> (1)
name: <vm_name>
spec:
dataVolumeTemplates:
- apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
name: <vm_name>
spec:
sourceRef:
kind: DataSource
name: rhel9
namespace: openshift-virtualization-os-images
storage:
resources:
requests:
storage: 30Gi
running: false
template:
metadata:
labels:
kubevirt.io/domain: <vm_name>
spec:
domain:
cpu:
cores: 1
sockets: 2
threads: 1
devices:
disks:
- disk:
bus: virtio
name: rootdisk
- disk:
bus: virtio
name: cloudinitdisk
interfaces:
- masquerade: {}
name: default
rng: {}
features:
smm:
enabled: true
firmware:
bootloader:
efi: {}
resources:
requests:
memory: 8Gi
evictionStrategy: LiveMigrate
networks:
- name: default
pod: {}
volumes:
- dataVolume:
name: <vm_name>
name: rootdisk
- cloudInitNoCloud:
userData: |-
#cloud-config
user: cloud-user
password: '<password>' (2)
chpasswd: { expire: False }
name: cloudinitdisk
| 1 | Specify the name of the virtual machine. |
| 2 | Specify the password for cloud-user. |
Create a virtual machine by using the manifest file:
$ oc create -f <vm_manifest_file>.yaml
Optional: Start the virtual machine:
$ virtctl start <vm_name>
KubeVirt v0.59.0 API Reference.
|
The KubeVirt API Reference is the upstream project reference and might contain parameters that are not supported in OpenShift Virtualization. |