Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 9. Creating and uploading a customized RHEL VMDK system image to vSphere
You can create customized RHEL system images by using Insights image builder and upload those images to the VMware vSphere client.
9.1. Creating a customized RHEL VMDK system image by using Insights image builder Link kopierenLink in die Zwischenablage kopiert!
With Insights image builder, you can create customized system images in the Open virtualization format (.ova) or in the Virtual disk (.vmdk) format. You can upload these images to VMware vSphere.
You can import the Virtual disk (.vmdk) format only with the govc client. As for the Open virtualization format (.ova), you can import it by using both the vSphere GUI and govc clients.
The Open virtualization format (.ova) is a .vmdk image with additional metadata about the virtual hardware, when imported it creates a VM. After importing the .ova image into vSphere, you can configure the VM with any additional hardware, such as network, disks and CD-ROM.
Procedure
Access Insights image builder on the browser.
The Insights image builder dashboard appears.
Click .
The Create image dialog wizard opens.
On the Image output page, complete the following steps:
- From the Release list, select the Release that you want to use: for example, choose Red Hat Enterprise Linux (RHEL).
-
From the Select target environments option, select
VMware. Select one of the options:
-
Open virtualization format (
.ova) Virtual disk (
.vmdk) formatClick .
-
Open virtualization format (
On the Registration page, select the type of registration that you want to use. You can select from these options:
- Register images with Red Hat - Register and connect image instances, subscriptions and insights with Red Hat. For details on how to embed an activation key and register systems on first boot, see Creating a customized system image with an embed subscription by using Insights image builder.
- Register image instances only - Register and connect only image instances and subscriptions with Red Hat.
- Register later - Register the system after the image creation.
- Click .
- Optional: On the Packages page, add packages to your image. See Adding packages during image creation by using Insights image builder.
- On the Name image page, enter a name for your image and click . If you do not enter a name, you can find the image you created by its UUID.
On the Review page, review the details about the image creation and click Create image.
After you complete the steps in the Create image wizard, the image builder dashboard is displayed.
When the new image displays a Ready status in the Status column, click Download .vmdk in the Instance column.
The .vmdk image is saved to your system and is ready for deployment.
NoteThe
.vmdkimages are available for 6 hours and expire after that. Ensure that you download the image to avoid losing it.
Additional resources
9.2. Deploying VMDK images to vSphere by using the GUI Link kopierenLink in die Zwischenablage kopiert!
After creating your Open virtualization format (.ova) image, you can deploy it to VMware vSphere by using the vSphere GUI client. It will create a VM which can be customized further before booting.
The GUI wizard does not support cloud-init.
Prerequisites
- You logged in to the vSphere UI in a browser.
-
You downloaded your (
.ova) image.
Procedure
- In the vSphere Client, from the Actions menu, select Deploy OVF Template.
- On the Deploy OVF Template page, complete the settings for each configuration option and click .
Click . The
.ovaimage starts to be deployed.After the image deployment is complete, you have a new virtual machine (VM) from the
.ovaimage.In the deployed image page, perform the following steps:
- From the Actions menu, select Edit Setting.
On the Virtual Hardware tab, configure resources such as CPU, memory, add a new network adapter, between others of your choice.
On the CD/DVD drive 1 option, attach a CD or DVD Drive that contains a
cloud-init.iso, to provision a user on startup.The VM is now ready to boot with the username and password from the
cloud-init.isofile.
Additional resources
- Deploy an OVF or OVA Template
- The govc documentation
- The VMware - cloud init 22.2 documentation
9.3. Deploying VMDK images to vSphere by using the CLI Link kopierenLink in die Zwischenablage kopiert!
After creating your image, you can deploy it to VMware vSphere by using the CLI. Then, you can create a VM and login into it.
The GUI wizard does not support cloud-init.
Prerequisites
You configured the
govcVMware CLI tool client.To use the
govcVMware CLI tool client, you must set the following values in the environment:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
-
Access the directory where you downloaded your
.vmdkimage. Create a file named
metadata.yaml. Add the following information to this file:instance-id: cloud-vm local-hostname: vmname
instance-id: cloud-vm local-hostname: vmnameCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a file named
userdata.yaml. Add the following information to the file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
ssh_authorized_keysis your SSH public key. You can find your SSH public key in~/.ssh/id_rsa.pub.
-
Export the
metadata.yamlanduserdata.yamlfiles to the environment, compressed withgzip, encoded inbase64as follows. They will be used in further steps.export METADATA=$(gzip -c9 <metadata.yaml | { base64 -w0 2>/dev/null || base64; }) \ USERDATA=$(gzip -c9 <userdata.yaml | { base64 -w0 2>/dev/null || base64; })export METADATA=$(gzip -c9 <metadata.yaml | { base64 -w0 2>/dev/null || base64; }) \ USERDATA=$(gzip -c9 <userdata.yaml | { base64 -w0 2>/dev/null || base64; })Copy to Clipboard Copied! Toggle word wrap Toggle overflow Launch the image on vSphere with the
metadata.yamlanduserdata.yamlfiles:Import the
.vmdkimage in to vSphere:govc import.vmdk ./composer-api.vmdk foldername
$ govc import.vmdk ./composer-api.vmdk foldernameCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the VM in vSphere without powering it on:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change the VM to add
ExtraConfigvariables, thecloud-initconfig:govc vm.change -vm vmname \ -e guestinfo.metadata="${METADATA}" \ -e guestinfo.metadata.encoding="gzip+base64" \ -e guestinfo.userdata="${USERDATA}" \ -e guestinfo.userdata.encoding="gzip+base64"govc vm.change -vm vmname \ -e guestinfo.metadata="${METADATA}" \ -e guestinfo.metadata.encoding="gzip+base64" \ -e guestinfo.userdata="${USERDATA}" \ -e guestinfo.userdata.encoding="gzip+base64"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Power-on the VM:
govc vm.power -on vmname
govc vm.power -on vmnameCopy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the VM IP address:
HOST=$(govc vm.ip vmname)
HOST=$(govc vm.ip vmname)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use SSH to log in to the VM, using the user-data specified in
cloud-initfile configuration:ssh admin@HOST
$ ssh admin@HOSTCopy to Clipboard Copied! Toggle word wrap Toggle overflow