This is a cache of https://docs.openshift.com/container-platform/4.2/cnv/cnv_users_guide/cnv-creating-vm-template.html. It is a snapshot of the page at 2024-11-23T02:38:14.101+0000.
Creating virtual machine templates - Container-native virtualization <strong>user</strong>'s guide | Container-native virtualization | OpenShift Container Platform 4.2
×

Using Virtual machines templates is an easy way to create multiple virtual machines with similar configuration. After a template is created, reference the template when creating virtual machines.

Creating a virtual machine template with the interactive wizard in the web console

The web console features an interactive wizard that guides you through the Basic Settings, Networking, and Storage screens to simplify the process of creating virtual machine templates. All required fields are marked with a *. The wizard prevents you from moving to the next screen until you provide values in the required fields.

Procedure
  1. In the container-native virtualization console, click WorkloadsVirtual Machine Templates.

  2. Click Create Template and select Create with Wizard.

  3. Fill in all required Basic Settings.

  4. Click Next to progress to the Networking screen. A NIC that is named nic0 is attached by default.

    1. Optional: Click Create NIC to create additional NICs.

    2. Optional: You can remove any or all NICs by clicking the Options menu kebab and selecting Remove NIC. Virtual machines created from a template do not need a NIC attached. NICs can be created after a virtual machine has been created.

  5. Click Next to progress to the Storage screen.

    1. Optional: Click Create Disk to create additional disks.

    2. Optional: Click a disk to modify available fields. Click the ✓ button to save the changes.

    3. Optional: Click Attach Disk to choose an available disk from the Select Storage list.

      If either URL or Container are selected as the Provision Source in the Basic Settings screen, a rootdisk disk is created and attached to virtual machines as the Bootable Disk. You can modify the rootdisk but you cannot remove it.

      A Bootable Disk is not required for virtual machines provisioned from a PXE source if there are no disks attached to the virtual machine. If one or more disks are attached to the virtual machine, you must select one as the Bootable Disk.

  6. Click Create Virtual Machine Template >. The Results screen displays the JSON configuration file for the virtual machine template.

    The template is listed in WorkloadsVirtual Machine Templates.

Virtual machine template interactive wizard fields

The following tables describe the fields for the Basic Settings, Networking, and Storage panes in the Create Virtual Machine Template interactive wizard.

Virtual machine template wizard fields

Name Parameter Description

Name

The name can contain lower-case letters (a-z), numbers (0-9), and hyphens (-), up to a maximum of 253 characters. The first and last characters must be alphanumeric. The name must not contain upper-case letters, spaces, periods (.), or special characters.

Description

Optional description field.

Provision Source

PXE

Provision virtual machine from PXE menu. Requires a PXE-capable NIC in the cluster.

URL

Provision virtual machine from an image available from an HTTP or S3 endpoint.

Container

Provision virtual machine from a bootable operating system container located in a registry accessible from the cluster. Example: kubevirt/cirros-registry-disk-demo.

Cloned Disk

Provision source is a cloned disk.

Import

Import virtual machine from a supported provider.

Operating System

A list of operating systems available in the cluster. This is the primary operating system for the virtual machine. If you select Import as the Provider Source, the operating system is filled in automatically, based on the operating system of the VMware virtual machine being imported.

Flavor

small, medium, large, tiny, Custom

Presets that determine the amount of CPU and memory allocated to the virtual machine.

Workload Profile

desktop

A virtual machine configuration for use on a desktop.

generic

A virtual machine configuration that balances performance and compatibility for a broad range of workloads.

high performance

A virtual machine configuration that is optimized for high-performance loads.

Use cloud-init

Select to enable the cloud-init fields.

Cloud-init fields

Name Description

Hostname

Sets a specific host name for the virtual machine.

Authenticated SSH Keys

The user’s public key that is copied to ~/.ssh/authorized_keys on the virtual machine.

Use custom script

Replaces other options with a field in which you paste a custom cloud-init script.

Networking fields

Name Description

Create NIC

Create a new NIC for the virtual machine.

NIC NAME

Name for the NIC.

MAC ADDRESS

MAC address for the network interface. If a MAC address is not specified, an ephemeral address is generated for the session.

NETWORK CONFIGURATION

List of available NetworkAttachmentDefinition objects.

BINDING METHOD

List of available binding methods. For the default Pod network, masquerade is the only recommended binding method. For secondary networks, use the bridge binding method. The masquerade method is not supported for non-default networks.

PXE NIC

List of PXE-capable networks. Only visible if PXE has been selected as the Provision Source.

Storage fields

Name Description

Create Disk

Create a new disk for the virtual machine.

Attach Disk

Select an existing disk, from a list of available PVCs, to attach to the virtual machine.

DISK NAME

Name of the disk. The name can contain lower-case letters (a-z), numbers (0-9), hyphens (-), and periods (.), up to a maximum of 253 characters. The first and last characters must be alphanumeric. The name must not contain upper-case letters, spaces, or special characters.

SIZE (GB)

Size, in GB, of the disk.

STORAGE CLASS

Name of the underlying StorageClass.

Bootable Disk

List of available disks from which the virtual machine will boot. This is locked to rootdisk if the Provision Source of the virtual machine is URL or Container.