Creating and using boot sources
A boot source contains a bootable operating system (OS) and all of the configuration settings for the OS, such as drivers.
You use a boot source to create virtual machine templates with specific configurations. These templates can be used to create any number of available virtual machines.
Quick Start tours are available in the OKD web console to assist you in creating a custom boot source, uploading a boot source, and other tasks. Select Quick Starts from the Help menu to view the Quick Start tours.
About virtual machines and boot sources
Virtual machines consist of a virtual machine definition and one or more disks that are backed by data volumes. Virtual machine templates enable you to create virtual machines using predefined virtual machine specifications.
Every virtual machine template requires a boot source, which is a fully configured virtual machine disk image including configured drivers. Each virtual machine template contains a virtual machine definition with a pointer to the boot source. Each boot source has a predefined name and namespace. For some operating systems, a boot source is automatically provided. If it is not provided, then an administrator must prepare a custom boot source.
Provided boot sources are updated automatically to the latest version of the operating system. For auto-updated boot sources, persistent volume claims (PVCs) are created with the cluster’s default storage class. If you select a different default storage class after configuration, you must delete the existing data volumes in the cluster namespace that are configured with the previous default storage class.
To use the boot sources feature, install the latest release of OKD Virtualization. The namespace openshift-virtualization-os-images
enables the feature and is installed with the OKD Virtualization Operator. Once the boot source feature is installed, you can create boot sources, attach them to templates, and create virtual machines from the templates.
Define a boot source by using a persistent volume claim (PVC) that is populated by uploading a local file, cloning an existing PVC, importing from a registry, or by URL. Attach a boot source to a virtual machine template by using the web console. After the boot source is attached to a virtual machine template, you create any number of fully configured ready-to-use virtual machines from the template.
Importing a Fedora image as a boot source
You can import a Fedora image as a boot source by specifying a URL for the image.
Prerequisites
- You must have access to a web page with the operating system image. For example: Download Red Hat Enterprise Linux web page with images.
Procedure
In the OKD console, click Virtualization → Templates from the side menu.
Identify the RHEL template for which you want to configure a boot source and click Add source.
In the Add boot source to template window, select URL (creates PVC) from the Boot source type list.
Click RHEL download page to access the Red Hat Customer Portal. A list of available installers and images is displayed on the Download Red Hat Enterprise Linux page.
Identify the Red Hat Enterprise Linux KVM guest image that you want to download. Right-click Download Now, and copy the URL for the image.
In the Add boot source to template window, paste the URL into the Import URL field, and click Save and import.
Verification
- Verify that the template displays a green checkmark in the Boot source column on the Templates page.
You can now use this template to create Fedora virtual machines.
Adding a boot source for a virtual machine template
A boot source can be configured for any virtual machine template that you want to use for creating virtual machines or custom templates. When virtual machine templates are configured with a boot source, they are labeled Source available on the Templates page. After you add a boot source to a template, you can create a new virtual machine from the template.
There are four methods for selecting and adding a boot source in the web console:
Upload local file (creates PVC)
URL (creates PVC)
Clone (creates PVC)
Registry (creates PVC)
Prerequisites
To add a boot source, you must be logged in as a user with the
os-images.kubevirt.io:edit
RBAC role or as an administrator. You do not need special privileges to create a virtual machine from a template with a boot source added.To upload a local file, the operating system image file must exist on your local machine.
To import via URL, access to the web server with the operating system image is required. For example: the Red Hat Enterprise Linux web page with images.
To clone an existing PVC, access to the project with a PVC is required.
To import via registry, access to the container registry is required.
Procedure
In the OKD console, click Virtualization → Templates from the side menu.
Click the options menu beside a template and select Edit boot source.
Click Add disk.
In the Add disk window, select Use this disk as a boot source.
Enter the disk name and select a Source, for example, Blank (creates PVC) or Use an existing PVC.
Enter a value for Persistent Volume Claim size to specify the PVC size that is adequate for the uncompressed image and any additional space that is required.
Select a Type, for example, Disk or CD-ROM.
Optional: Click Storage class and select the storage class that is used to create the disk. Typically, this storage class is the default storage class that is created for use by all PVCs.
Provided boot sources are updated automatically to the latest version of the operating system. For auto-updated boot sources, persistent volume claims (PVCs) are created with the cluster’s default storage class. If you select a different default storage class after configuration, you must delete the existing data volumes in the cluster namespace that are configured with the previous default storage class.
Optional: Clear Apply optimized StorageProfile settings to edit the access mode or volume mode.
Select the appropriate method to save your boot source:
Click Save and upload if you uploaded a local file.
Click Save and import if you imported content from a URL or the registry.
Click Save and clone if you cloned an existing PVC.
Your custom virtual machine template with a boot source is listed on the Catalog page. You can use this template to create a virtual machine.
Creating a virtual machine from a template with an attached boot source
After you add a boot source to a template, you can create a virtual machine from the template.
Procedure
In the OKD web console, click Virtualization → Catalog in the side menu.
Select the updated template and click Quick create VirtualMachine.
The VirtualMachine details is displayed with the status Starting.