Build Golden Images For Your Openshift Virtualization Cloud Using RHEL Image Builder

Prerequisites

  • An Installed Openshift Cluster (4.10)
  • An Installed Openshift Virtualization Operator (4.10)
  • An RHEL server to compose & Upload images

Compose Your Custom RHEL8.5 QCOW2 Image

$ yum install -y lorax-composer composer-cli
$ systemctl enable --now osbuild-composer.socket && systemctl start --now osbuild-composer.socket
name = "rhel8.5-devops-tools"
description = "This image is used for developers searching for pre-build DevOps ariented rhel8.5 os"
version = "0.0.1"
modules = []
groups = []
distro = ""
[[packages]]
name = "wget"
version = "*"
[[packages]]
name = "git"
version = "*"
[customizations]
hostname = "rhel8"
[[customizations.user]]
name = "spaz"
description = "spaz"
password = "$6$pJXZ3nD7NbAXr2A8$.Mv9dKlxBoihmeSpTjpt61zuA0X9GCUZu/Wb/jRvJKpzgCb7IliVx7Pr6GTKa3zL6s3zl30SkbzZo5vWZkJCz/"
key = "ssh-rsa ..."
groups = ["wheel"]
$ composer-cli blueprints push rhel8.5-devops-tools.toml
$ composer-cli blueprints show rhel8.5-devops-toolsname = "rhel8.5-devops-tools"
description = "This image is used for developers searching for pre-build DevOps ariented rhel8.5 os"
version = "0.0.1"
modules = []
groups = []
distro = ""
.
.
.
$ composer-cli compose start rhel8.5-devops-tools qcow2Compose ecad14a5-1123-4e10-9edf-172152495eb2 added to the queue
$ composer-cli compose status c7d6247c-70a7-4bea-90aa-61a647ffacbe FINISHED Wed Jun 1 05:05:30 2022 rhel8.5-devops-tools 0.0.1 qcow2            10737418240
$ composer-cli compose image c7d6247c-70a7-4bea-90aa-61a647ffacbec7d6247c-70a7-4bea-90aa-61a647ffacbe-disk.qcow2
$ ll -h *.qcow2-rw------- 1 root root 784M Jun  1 05:07 c7d6247c-70a7-4bea-90aa-61a647ffacbe-disk.qcow2

Upload Your QCOW2 Image As Data Volume

$ wget https://hyperconverged-cluster-cli-download-openshift-cnv.apps.<cluster_name>.<domain>/amd64/linux/virtctl.tar.gz --no-check-certificate
$ virtctl image-upload dv rhel8.5-devops-tools --size=20G --image-path=c7d6247c-70a7-4bea-90aa-61a647ffacbe-disk.qcow2 --insecurePVC test-vms/rhel8.5-devops-tools not found 
DataVolume test-vms/rhel8.5-devops-tools created
Waiting for PVC rhel8.5-devops-tools upload pod to be ready...
Pod now ready
Uploading data to https://cdi-uploadproxy-openshift-cnv.apps.ocp.spaz.local
783.62 MiB / 783.62 MiB [=========================================================================================================] 100.00% 3m19sUploading data completed successfully, waiting for processing to complete, you can hit ctrl-c without interrupting the progress
Processing completed successfully
Uploading c7d6247c-70a7-4bea-90aa-61a647ffacbe-disk.qcow2 completed successfully
$ oc get dv | grep rhel8.5-devops-toolsrhel8.5-devops-tools                          Succeeded   N/A                   13m
$ oc get templateNAME                   DESCRIPTION   PARAMETERS    OBJECTS
rhel8.5-devops-tools 2 (1 blank) 1
$ ssh spaz@ocp-worker02.spaz.local -p 32725Activate the web console with: systemctl enable --now cockpit.socketRegister this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Wed Jun 1 06:19:30 2022 from 10.130.0.1
[spaz@rhel8 ~]$ which git
/usr/bin/git

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store