OpenShift Virtualization is Red Hat’s distribution of KubeVirt, and it includes the Containerized Data Importer (CDI). The CloudSOE KubeVirt images work on it without changes. The manifests are the same as on any KubeVirt cluster; you apply them with oc.
What you’ll need
- An OpenShift cluster with the OpenShift Virtualization operator installed
oc, andvirtctl(downloadable from the web console’s command line tools page)- A project to create the VM in
Start a VM from the containerdisk
oc new-project vm-demo
Save this as ubuntu-24-04.yaml and replace the SSH key with your own:
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: ubuntu-24-04
spec:
runStrategy: Always
template:
spec:
domain:
cpu:
cores: 1
memory:
guest: 2Gi
devices:
disks:
- name: rootdisk
disk:
bus: virtio
- name: cloudinit
disk:
bus: virtio
interfaces:
- name: default
masquerade: {}
networks:
- name: default
pod: {}
volumes:
- name: rootdisk
containerDisk:
image: quay.io/cloudsoe/ubuntu-24.04:202611.14.0
- name: cloudinit
cloudInitNoCloud:
userData: |
#cloud-config
ssh_authorized_keys:
- ssh-ed25519 AAAA... [email protected]
oc apply -f ubuntu-24-04.yaml
oc get vmi ubuntu-24-04 --watch
virtctl ssh ubuntu@vm/ubuntu-24-04
The VM also appears in the web console under Virtualization, where you can open its console.
The image is pulled from quay.io, so the cluster needs access to it. In a disconnected cluster, mirror quay.io/cloudsoe/ubuntu-24.04 to your own registry and change the image line.
Add the image as a boot source
OpenShift Virtualization keeps its boot sources as DataSources in the openshift-virtualization-os-images namespace. A DataImportCron there imports the CloudSOE image and keeps it current:
apiVersion: cdi.kubevirt.io/v1beta1
kind: DataImportCron
metadata:
name: cloudsoe-ubuntu-24-04
namespace: openshift-virtualization-os-images
spec:
schedule: "0 3 * * 1"
managedDataSource: cloudsoe-ubuntu-24-04
garbageCollect: Outdated
importsToKeep: 2
template:
spec:
source:
registry:
url: docker://quay.io/cloudsoe/ubuntu-24.04:latest
storage:
resources:
requests:
storage: 20Gi
oc apply -f cloudsoe-ubuntu-24-04-cron.yaml
oc get datasource -n openshift-virtualization-os-images cloudsoe-ubuntu-24-04
Creating objects in that namespace needs cluster-admin rights. Without them, create the DataImportCron in your own project and reference that namespace instead.
A VM clones its root disk from the DataSource:
dataVolumeTemplates:
- metadata:
name: ubuntu-24-04-root
spec:
sourceRef:
kind: DataSource
name: cloudsoe-ubuntu-24-04
namespace: openshift-virtualization-os-images
storage:
resources:
requests:
storage: 20Gi
Use it with a dataVolume volume, as shown in persistent disks with CDI.
Support
These are community images of upstream distributions. They are not Red Hat certified guest operating systems. Check Red Hat’s support policy if you need a supported guest.