From b2d2238d7f679982517f0383f5eb7a6dafb6d48f Mon Sep 17 00:00:00 2001 From: Alan Cowles Date: Wed, 21 Aug 2024 15:03:38 -0400 Subject: [PATCH] re-wrote instancetype section to update for 4.16 --- .../ROOT/pages/module-07-tempinst.adoc | 368 +----------------- 1 file changed, 14 insertions(+), 354 deletions(-) diff --git a/content/modules/ROOT/pages/module-07-tempinst.adoc b/content/modules/ROOT/pages/module-07-tempinst.adoc index abb5824..a5f5081 100644 --- a/content/modules/ROOT/pages/module-07-tempinst.adoc +++ b/content/modules/ROOT/pages/module-07-tempinst.adoc @@ -339,7 +339,7 @@ image::module-07-tempinst/29_Clone_Menu.png[link=self, window=blank, width=100%] . Return to the *Virtualization -> Catalog* menu, and use this cloned PVC as a boot source for quick-creating new virtual machines by selecting the option for *PVC (clone PVC)* as the *Disk source*, and selecting the *Windows-2k19-Sysprep-Template* PVC as the *PVC name* to clone, and click the *Quick create VirtualMachine* button. + -image::module-07-tempinst/29_Windows_Template.png[link=self, window=blank, width=100%] +image::module-07-tempinst/30_Windows_Template.png[link=self, window=blank, width=100%] [[instance_types]] == Introduction to Instance Types @@ -348,388 +348,48 @@ In order to simplify the deployment process for virtual machines, starting with . To get started click on *Virtualization* -> *Catalog* on the left-side menu. You will see the default catalog item is *InstanceType*. + -image::module-07-tempinst/30_Left_Menu_Catalog.png[link=self, window=blank, width=100%] +image::module-07-tempinst/31_Left_Menu_Catalog.png[link=self, window=blank, width=100%] -. The first step to using an instance type is to select a volume to boot from. Similar to the templates that provide boot sources, those boot sources are available to use for an instance type, or you can upload your own with the *Add volume* button. - -. Click on *rhel9* to create a VM with that boot source. -+ -image::module-07-tempinst/31_Volume_Boot.png[link=self, window=blank, width=100%] - -. Next you can select the instance type you would like to use. There are Red Hat provided instance types by default, or you can create your own. If you hover over a provided instance type you can see a description of it's intended use. -+ -image::module-07-tempinst/32_Select_InstanceType.png[link=self, window=blank, width=100%] -+ -* The Red Hat provided instance types are intended for the following uses: -** cx1: Intended for compute intensive workloads -** u1: The most general and "universal" workloads -** gn1: Dedicated for VMs making use of the nVidia GPU operator. -** n1: Designed for network intensive workloads like VNF -** m1: Designed for memory intensive workloads. - -. Click on the *U series* tile to see a dropdown list of defined resources for general instance types. The default option here is *medium: 1 CPUs, 4 GiB Memory*. Select it. -+ -image::module-07-tempinst/33_InstanceType_Resources.png[link=self, window=blank, width=100%] - -. The last section that needs to be completed to provision using an instance type is similar to the template section. You need to provide a name for the virtual machine, and select the storage class to be used for a backing disk. By default, a name will be generated for the VM, and the default virtualization storage class will be selected. When you are satisfied, click the *Create VirtualMachine* button. -+ -image::module-07-tempinst/34_VM_Details.png[link=self, window=blank, width=100%] - -. You will be directed to the virtual machine overview page, and see that the VM provisioned using an instance type is now up and running. -+ -image::module-07-tempinst/35_VM_Overview.png[link=self, window=blank, width=100%] - -[[cleanup]] -== Cleanup - -To save resources for the next lab, stop the VMs that you created in this module. - -. Navigate to *Virtualization -> Virtualmachines* -. Make sure you check every project that you have access to to see all VMs in the environment. At a minimum you should check projects `vmimported-{user}` and `vmexamples-{user}` -. If any VMs are showing a status of *Running* click the three dots to the right and select *Stop*. - -Now all VMs should be in *Stopped* state. - -== Summary - -In this section we learned how to clone and customize and existing template to create one that can be used for specific workloads like databases. We also learned how to configure one of the existing Windows templates that exists without a boot source, and automate it's installation process, so we can create future templates by cloning the installation PVC that is created with that VM. We also introduced how to make use of instance types to further customize our virtual machines for specific workloads.[link=self, window=blank, width=100%] -+ - -. A new menu called *Clone template* will appear, fill in the the following values, and when finished click on the *Clone* button. -+ -* *Template name:* centos-stream9-server-db-small -* *Template project:* vmexamples-{user} -* *Template display name:* CentOS Stream 9 VM - Database Template Small -+ -image::module-07-tempinst/04_Clone_Template_Options.png[link=self, window=blank, width=100%] - -. This will take you to the *Details* page for the template where we will be able to customize some options. Start by finding the CPU and Memory near the bottom of the page, and click on the pencil icon to edit it. -+ -image::module-07-tempinst/05_Clone_Details.png[link=self, window=blank, width=100%] - -. A new window will pop out where you can edit the amount of CPU and Memory. For our custom template set the value of CPUs to 2, and Memory to 4 GiB, and click the *Save* button. -+ -image::module-07-tempinst/06_Edit_CPU_Mem.png[link=self, window=blank, width=100%] - -. Next click on the *Scripts* tab at the top, and in the section called *Cloud-init* click the *Edit* button. -+ -image::module-07-tempinst/09_Scripts_CloudInit.png[link=self, window=blank, width=100%] - -. When the *Cloud-init* dialog opens, click the radio button to *Configure via: Script* then *replace* the YAML with the following YAML snippet. -+ -[source,yaml,role=execute] ----- -userData: |- - #cloud-config - user: centos - password: ${CLOUD_USER_PASSWORD} - chpasswd: { expire: False } - packages: - - mariadb-server - runcmd: - - systemctl enable mariadb - - systemctl start mariadb ----- -+ -image::module-07-tempinst/10_Cloud_Init_Script.png[link=self, window=blank, width=100%] - -. Click the *Save* button, followed by the *Apply* button. - -. Now click on the *Virtualization -> Catalog* menu on the left, select the *Template catalog* option. You should see your created template available as a tile with all the others. +. The first step to using an instance type is to select a volume to boot from. Similar to the templates that provide boot sources, those boot sources are available to use for guests provisioned with an InstanceType. You can see the included volumes by selecting the *openshift-virtualization-os-images* project, or you can upload your own with the *Add volume* button. + -image::module-07-tempinst/11_User_Templates.png[link=self, window=blank, width=100%] - -. Click on the tile and you will be prompted with the VM startup screen. Click the *Quick create VirtualMachine* button. -+ -image::module-07-tempinst/12_Quick_Create_Template.png[link=self, window=blank, width=100%] +NOTE: The *Add Volume* option will be greyed out if you aren't in a project that you have read/write access to. -. When the virtual machine boots you can see on the *Overview* page that it was created from our template, and has the additional resources we defined. We just need to verify that it installed *MariaDB* for us. -+ -image::module-07-tempinst/13_VM_From_Template.png[link=self, window=blank, width=100%] - -. Click on the *Console* tab at the top and use the *Guest login credentials* option to login to the console of the virtual machine. + -image::module-07-tempinst/14_VM_Console.png[link=self, window=blank, width=100%] +image::module-07-tempinst/32_Volume_Boot.png[link=self, window=blank, width=100%] -. Once you are logged into the virtual machine, run the following command to test the install of MariaDB. -+ -[source,sh,role=execute] ----- -sudo mysql -u root ----- +. Click on the *rhel9* boot volume to select it as the volume type to boot from. Selecting it will be denoted by a small vertical blue line to the left of the image name. + -image::module-07-tempinst/15_MariaDB_Login.png[link=self, window=blank, width=100%] - -. Hit `Ctrl-D` twice to log out of the VM. - -[[create_win]] -== Create a Windows VM Template - -In this segment of our lab, we will install Microsoft Windows Server 2019 using an ISO hosted on a web server. This represents one way to install an operating system to a virtual machine that takes advantage of the ability to source disks from many locations, including a web server, object storage, or other persistent volumes in the cluster. - -This process can be streamlined after the initial operating system installation by creating a template from the virtual machine. The specific process for preparing the guest operating system to be used as a template will vary, be sure to follow your organization's guidelines and requirements when preparing a template OS. - -. From the left menu, navigate to *Virtualization* -> *Catalog*, and click on the *Template catalog* tab near the top.. -+ -image::module-07-tempinst/16_Template_Catalog.png[link=self, window=blank, width=100%] - -. Make sure you are in the *vmexamples-{user}* project. -. Scroll down until you find the *Microsoft Windows Server 2019 VM* tile. -+ -image::module-07-tempinst/17_Windows_2k19_Tile.png[link=self, window=blank, width=100%] - -. A dialog will appear showing the default configuration related to the template. -+ -NOTE: Notice that there is intially no option to quick create this VM, and we must customize the VM to fit our needs. -+ -image::module-07-tempinst/18_Windows_2k19_Dialog.png[link=self, window=blank, width=100%] -+ -. In this dialog: -.. Specify the name *windows* -.. Enable the checkbox *Boot from CD* -.. Choose URL *(creates PVC)* from the drop-down menu -.. Specify the *image URL*: https://catalog-item-assets.s3.us-east-2.amazonaws.com/qcow_images/Windows2019.iso -.. Reduce the CD disk size to *5 GiB* -.. Keep the *Disk source* size disk to the default value *60 GiB* -.. Ensure the *Mount Windows drivers disk* checkbox is enabled. **This is required to install Windows systems, which will provide the drivers for VirtIO.** -+ -image::module-07-tempinst/19_Windows_2k19_Parameters.png[link=self, window=blank, width=100%] - -. With the options filled out, we want to click on the *Customize VirtualMachine* button at the bottom to continue configuring our Template. -. On the *Customize and create VirtualMachine* screen, click on the *Scripts* tab, and then scroll down to the *Sysprep* section and click on the *Edit* button. -+ -image::module-07-tempinst/20_Customize_Scripts.png[link=self, window=blank, width=100%] - -. A new window will pop up for you to create *Sysprep* actions for your new template. -+ -image::module-07-tempinst/21_Sysprep.png[link=self, window=blank, width=100%] - -. Copy and paste the following code block into the *autounattend.xml* section: -+ -[source,xml,role=execute] ----- - - - - - - - - - 1 - true - Primary - - - - - true - NTFS - - 1 - 1 - - - 0 - true - - - - - - - /IMAGE/NAME - Windows Server 2019 SERVERSTANDARD - - - - 0 - 1 - - - - - true - Administrator - My Organization - - false - - - - en-US - - en-US - en-US - en-US - en-US - - - - - false - - - - - - - R3dh4t1! - true</PlainText> - </Password> - <Enabled>true</Enabled> - <LogonCount>999</LogonCount> - <Username>Administrator</Username> - </AutoLogon> - <OOBE> - <HideEULAPage>true</HideEULAPage> - <HideLocalAccountScreen>true</HideLocalAccountScreen> - <HideOnlineAccountScreens>true</HideOnlineAccountScreens> - <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> - <NetworkLocation>Work</NetworkLocation> - <ProtectYourPC>3</ProtectYourPC> - <SkipMachineOOBE>true</SkipMachineOOBE> - </OOBE> - <UserAccounts> - <LocalAccounts> - <LocalAccount wcm:action="add"> - <Description>Local Administrator Account</Description> - <DisplayName>Administrator</DisplayName> - <Group>Administrators</Group> - <Name>Administrator</Name> - </LocalAccount> - </LocalAccounts> - </UserAccounts> - <TimeZone>Eastern Standard Time</TimeZone> - </component> - </settings> - <settings pass="oobeSystem"> - <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> - <InputLocale>en-US</InputLocale> - <SystemLocale>en-US</SystemLocale> - <UILanguage>en-US</UILanguage> - <UserLocale>en-US</UserLocale> - </component> - <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> - <AutoLogon> - <Password> - <Value>R3dh4t1!</Value> - <PlainText>true</PlainText> - </Password> - <Enabled>true</Enabled> - <LogonCount>999</LogonCount> - <Username>Administrator</Username> - </AutoLogon> - <OOBE> - <HideEULAPage>true</HideEULAPage> - <HideLocalAccountScreen>true</HideLocalAccountScreen> - <HideOnlineAccountScreens>true</HideOnlineAccountScreens> - <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> - <NetworkLocation>Work</NetworkLocation> - <ProtectYourPC>3</ProtectYourPC> - <SkipMachineOOBE>true</SkipMachineOOBE> - </OOBE> - <UserAccounts> - <LocalAccounts> - <LocalAccount wcm:action="add"> - <Description>Local Administrator Account</Description> - <DisplayName>Administrator</DisplayName> - <Group>Administrators</Group> - <Name>Administrator</Name> - </LocalAccount> - </LocalAccounts> - </UserAccounts> - <TimeZone>Eastern Standard Time</TimeZone> - </component> - </settings> -</unattend> ----- - -. Once the code is pasted, click the *Save* button on the dialog. -+ -image::module-07-tempinst/22_Windows_2k19_Sysprep.png[link=self, window=blank, width=100%] - -. You will be returned to the *Customize and create Virtual Machine* screen, Click on the *Disks* tab, and locate the line for the *installation-CDROM*, click the three-dot menu on the right, and select *Edit*. -+ -image::module-07-tempinst/23_Edit_Boot_Media.png[link=self, window=blank, width=100%] - -. Select the option for *Use this disk as a boot source*, and click on the *Save* button at the bottom. -+ -image::module-07-tempinst/24_Boot_Source.png[link=self, window=blank, width=100%] -+ -[NOTE] -==== -The disk may already be selected as boot source - in that case the checkbox is pre-checked and grayed out. In that case continue without changing anything. -==== - -. When you return to the *Disks* tab, click on the *Create VirtualMachine* button at the bottom. -. The Virtual Machine will start the provisioning process by downloading the ISO image, configuring, and starting the instance. -+ -image::module-07-tempinst/25_Windows_2k19_Provisioning.png[link=self, window=blank, width=100%] - -. After a few minutes, the Virtual VM will be in *Running* status. Switch to the *Console* tab: -+ -image::module-07-tempinst/26_Windows_2k19_Console.png[link=self, window=blank, width=100%] -+ -IMPORTANT: The VM is marked as "Not migratable" because a CD-ROM disk is attached. - -. Once the VM installation process is complete (provisioning will take about 3 minutes, starting and configuring will take about 10 minutes), go ahead and power it off with the stop button. We can now take a snapshot of the root disk, and use that to create a bootable volume template that we can use to boot other Windows 2k19 machines. -. Click on *Storage* -> *PersistentVolumeClaims* to see a list of PVCs available in the *vmexamples-{user}* namespace. -+ -image::module-07-tempinst/27_Windows_PVC.png[link=self, window=blank, width=100%] - -. Find the *windows* PVC that is listed and using the three-dot menu on the right select *Clone PVC*. On the menu that pops up, name the new PVC *windows-2k19-template*. -+ -image::module-07-tempinst/28_Clone_Windows_PVC.png[link=self, window=blank, width=100%] - -. Once this is saved, you can return to the *Virtualization -> Catalog* menu, and use this cloned PVC as a future boot source for creating new Virtual Machines by selecting the option for *PVC (clone PVC)* as the *Disk source*, and selecting the *Windows-2k19-Template* PVC as the *PVC name* to clone. -+ -image::module-07-tempinst/29_Windows_Template.png[link=self, window=blank, width=100%] - -[[instance_types]] -== Introduction to Instance Types - -In order to simplify the deployment process for virtual machines, starting with OpenShift 4.14 the default configuration mechanism was changed to emphasize the use of *Instance Types*. An instance type is a reusable object where you can define resources and characteristics to apply to a new VM. You can define custom instance types or use the variety that are included when you install OpenShift Virtualization when provisioning your own VM. This section explores provisioning a VM using an instance type. - -. To get started click on *Virtualization* -> *Catalog* on the left-side menu. You will see the default catalog item is *InstanceType*. -+ -image::module-07-tempinst/30_Left_Menu_Catalog.png[link=self, window=blank, width=100%] - -. The first step to using an instance type is to select a volume to boot from. Similar to the templates that provide boot sources, those boot sources are available to use for an instance type, or you can upload your own with the *Add volume* button. - -. Click on *rhel9* to create a VM with that boot source. -+ -image::module-07-tempinst/31_Volume_Boot.png[link=self, window=blank, width=100%] +image::module-07-tempinst/33_Select_RHEL9.png[link=self, window=blank, width=100%] . Next you can select the instance type you would like to use. There are Red Hat provided instance types by default, or you can create your own. If you hover over a provided instance type you can see a description of it's intended use. + -image::module-07-tempinst/32_Select_InstanceType.png[link=self, window=blank, width=100%] +image::module-07-tempinst/34_Select_InstanceType.png[link=self, window=blank, width=100%] + * The Red Hat provided instance types are intended for the following uses: +** n1: Designed for network intensive workloads like VNF ** cx1: Intended for compute intensive workloads ** u1: The most general and "universal" workloads ** gn1: Dedicated for VMs making use of the nVidia GPU operator. -** n1: Designed for network intensive workloads like VNF ** m1: Designed for memory intensive workloads. . Click on the *U series* tile to see a dropdown list of defined resources for general instance types. The default option here is *medium: 1 CPUs, 4 GiB Memory*. Select it. + -image::module-07-tempinst/33_InstanceType_Resources.png[link=self, window=blank, width=100%] +image::module-07-tempinst/35_InstanceType_Resources.png[link=self, window=blank, width=100%] -. The last section that needs to be completed to provision using an instance type is similar to the template section. You need to provide a name for the virtual machine, and select the storage class to be used for a backing disk. By default, a name will be generated for the VM, and the default virtualization storage class will be selected. When you are satisfied, click the *Create VirtualMachine* button. +. The last section that needs to be completed to provision using an instance type is similar to the template section. You need to provide a name for the virtual machine, and select the storage class to be used for a backing disk. By default, a name will be generated for the VM, and the default storage class will be selected. When you are satisfied, click the *Create VirtualMachine* button. + -image::module-07-tempinst/34_VM_Details.png[link=self, window=blank, width=100%] +image::module-07-tempinst/36_VM_Details.png[link=self, window=blank, width=100%] . You will be directed to the virtual machine overview page, and see that the VM provisioned using an instance type is now up and running. + -image::module-07-tempinst/35_VM_Overview.png[link=self, window=blank, width=100%] +image::module-07-tempinst/37_VM_Overview.png[link=self, window=blank, width=100%] [[cleanup]] == Cleanup To save resources for the next lab, stop the VMs that you created in this module. -. Navigate to *Virtualization -> Virtualmachines* +. Navigate to *Virtualization -> VirtualMachines* . Make sure you check every project that you have access to to see all VMs in the environment. At a minimum you should check projects `vmimported-{user}` and `vmexamples-{user}` . If any VMs are showing a status of *Running* click the three dots to the right and select *Stop*.