You can create custom templates to provision VMs in Red Hat OpenShift Virtualization. In the OpenShift web console, navigate to the → to browse and select from the catalog of available operating systems for cluster templates, or define new ones by navigating to → and create and manage cluster templates.
![]() |
You cannot access custom templates within a specific project from other projects.
To make a custom template available to all projects, create the template in the openshift namespace, where the cluster templates are.
Use the oc get templates -n openshift command to view a list of available templates to all projects.
Navigate to → and click . Customize the parameters in the YAML editor and click .
The following YAML template includes the required parameters for a manifest that you can either paste into the YAML template creation editor in the web console or add by using the oc command-line client.
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: ${NAME}
namespace: template-create
labels:
os.template.kubevirt.io/rhel8: "true"
template.kubevirt.io/type: vm
workload.template.kubevirt.io/server: "true"
annotations:
description: VM template example
iconClass: icon-rhel
name.os.template.kubevirt.io/rhel8: Rhel 8.0 VM
openshift.io/display-name: Rhel 8.0 VM
...output omitted...
spec:
dataVolumeTemplates:
- apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
name: ${NAME}
spec:
storage:
resources:
requests:
storage: 30Gi
storageClassName: ocs-external-storagecluster-ceph-rbd
source:
http:
url: "http://utility.lab.example.com:8080/openshift4/images/mariadb-server.qcow2"
running: false
template:
...output omitted...
devices:
disks:
- disk:
bus: virtio
name: rootdisk
- disk:
bus: virtio
name: cloudinitdisk
interfaces:
- masquerade: {}
name: default
model: virtio
...output omitted...
hostname: ${NAME}
networks:
- name: default
pod: {}
terminationGracePeriodSeconds: 180
volumes:
- dataVolume:
name: ${NAME}
name: rootdisk
- cloudInitNoCloud:
userData: |-
#cloud-config
user: ${CLOUD_USER_PASSWORD}
password: ${CLOUD_USER_PASSWORD}
chpasswd: { expire: False }
name: cloudinitdisk
parameters:
- name: NAME
description: VM name
generate: expression
from: 'template-create-vm'
- name: CLOUD_USER_PASSWORD
description: User name and password for the cloud-init user cloud-user
generate: expression
from: 'developer'General parameters found in a template manifest:
When creating custom templates, many parameters provide the appropriate information, definitions, and supporting descriptions.
Review each category to view the default selections and the customizable options. These categories store the template definitions that define cluster resources:
: Overview of the template definition.
: YAML view of the template definition.
: Add, edit, or remove node selectors, tolerations, affinity rules, dedicated resources, and eviction strategies.
: Add, edit, or remove network interfaces.
: Add, edit, or remove disks.
: cloud-init, sysprep, and SSH access configurations.
: Add, edit, or remove additional parameters.
After you create a custom template, it is listed among the available virtual machine templates. From the web console, navigate to → and browse through the list of templates. To refine your search, use the search bar or the provided filters.
![]() |
Select the card of the template to create a VM on.
Review the template information, change the CPU | Memory or VM name if needed, and then click .
If you need additional customizations, then select and follow the prompts.
![]() |
Navigate to → to view the created VM.
![]() |
For more information, refer to the Creating Virtual Machine from Templates section in the Red Hat OpenShift Container Platform 4.14 documentation at https://access.redhat.com/documentation/en-us/openshift_container_platform/4.14/html-single/virtualization/index#virt-creating-vms-from-templates