Search

Chapter 9. Creating VMDK images for RHEL for Edge

download PDF

You can create a .vmdk image for RHEL for Edge by using the RHEL image builder. You can create an edge-vsphere image type with Ignition support, to inject the user configuration into the image at an early stage of the boot process. Then, you can load the image on vSphere and boot the image in a vSphere VM. The image is compatible with ESXi 7.0 U2, ESXi 8.0 and later. The vSphere VM is compatible with version 19 and 20.

9.1. Creating a blueprint with the Ignition configuration

Create a blueprint for the .vmdk image and customize it with the customizations.ignition section. With that, you can create your image and, at boot time, the operating system will inject the user configuration to the image.

Prerequisites

  • You have created an Ignition configuration file. For example:

    {
       "ignition":{
          "version":"3.3.0"
       },
       "passwd":{
          "users":[
             {
                "groups":[
                   "wheel"
                ],
                "name":"core",
                "passwordHash":"$6$jfuNnO9t1Bv7N"
             }
          ]
       }
    }

Procedure

  1. Create a blueprint in the Tom’s Obvious, Minimal Language (TOML) format, with the following content:

    name = "vmdk-image"
    description = "Blueprint with Ignition for the vmdk image"
    version = "0.0.1"
    packages = ["open-vm-tools"]
    modules = []
    groups = []
    distro = ""
    
    [[customizations.user]]
    name = "admin"
    password = "admin"
    groups = ["wheel"]
    
    [customizations.ignition.firstboot]
    url = http://<IP_address>:8080/config.ig

    Where:

    • The name is the name and description is the description for your blueprint.
    • The version is the version number according to the Semantic Versioning scheme.
    • The modules and packages describe the package name and matching version glob to be installed into the image. For example, the package name = "open-vm-tools". Notice that currently there are no differences between packages and modules.
    • The groups are packages groups to be installed into the image. For example groups = "anaconda-tools" group package. If you do not know the modules and groups, leave them empty.
    • The customizations.user creates a username and password to log in to the VM.
    • The customizations.ignition.firstboot contains the URL where the Ignition configuration file is being served.

      Note

      By default, the open-vm-tools package is not included in the edge-vsphere image. If you need this package, you must include it in the blueprint customization.

  2. Import the blueprint to the image builder server:

    # composer-cli blueprints push <blueprint-name>.toml
  3. List the existing blueprints to check whether the created blueprint is successfully pushed and exists:

    # composer-cli blueprints show <blueprint-name>
  4. Check whether the components and versions listed in the blueprint and their dependencies are valid:

    # composer-cli blueprints depsolve <blueprint-name>

Next steps

  • Use the blueprint you created to build your .vmdk image.

9.2. Creating a VMDK image for RHEL for Edge

To create a RHEL for Edge .vmdk image, use the 'edge-vsphere' image type in the RHEL image builder command-line interface.

Prerequisites

Procedure

  1. Start the compose of a .vmdk image:

    # composer-cli compose start start-ostree <blueprint-name> edge-vsphere --<url>

    The --<url> is the URL of your repo, for example: http://10.88.0.1:8080/repo.

    A confirmation that the composer process has been added to the queue appears. It also shows a Universally Unique Identifier (UUID) number for the image created. Use the UUID number to track your build. Also, keep the UUID number handy for further tasks.

  2. Check the image compose status:

    # composer-cli compose status

    The output displays the status in the following format:

    $ <UUID> RUNNING date <blueprint-name>  <blueprint-version> edge-vsphere
  3. After the compose process finishes, download the resulting image file:

    # composer-cli compose image <UUID>

Next steps

  • Upload the .vmdk image to vSphere.

9.3. Uploading VMDK images and creating a RHEL virtual machine in vSphere

Upload the .vmdk image to VMware vSphere by using the govc import.vmdk CLI tool and boot the image in a VM.

Prerequisites

  • You created an .vmdk image by using RHEL image builder and downloaded it to your host system.
  • You installed the govc import.vmdk CLI tool.
  • You configured the govc import.vmdk CLI tool client.

    • You must set the following values in the environment:

      GOVC_URL
      GOVC_DATACENTER
      GOVC_FOLDER
      GOVC_DATASTORE
      GOVC_RESOURCE_POOL
      GOVC_NETWORK

Procedure

  1. Navigate to the directory where you downloaded your .vmdk image.
  2. Launch the image on vSphere by executing the following steps:

    1. Import the .vmdk image in to vSphere:

      $ govc import.vmdk ./composer-api.vmdk foldername
    2. Create the VM in vSphere without powering it on:

      govc vm.create \
      -net="VM Network" -net.adapter=vmxnet3 \
      -disk.controller=pvscsi -on=false \
      -m=4096 -c=2 -g=rhel9_64Guest \
      -firmware=efi vm_name govc vm.disk.attach \
      -disk=”foldername/composer-api.vmdk” govc vm.power -on\
      -vm vm_name -link=false \
       vm_name
    3. Power-on the VM:

      govc vm.power -on vmname
    4. Retrieve the VM IP address:

      HOST=$(govc vm.ip vmname)
    5. Use SSH to log in to the VM, using the username and password you specified in your blueprint:

      $ ssh admin@HOST
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.