Images and templates¶
VM templates define the OS image used when deploying a virtual machine. Templates are either container disks (cloud-init Linux) or ISO imports (typically Windows via CDI).
Platform vs tenant templates¶
| Scope | tenant_id |
Who manages | Examples |
|---|---|---|---|
| Platform | empty | Seeded at startup; read-only in UI | cirros, ubuntu-2204, windows-server-2022 |
| Tenant | tenant UUID | Bootstrap or UI/API | e.g. fedora-39 |
Tenants see both platform and their own templates. Platform templates are not copied per tenant.
Container disks¶
KubeVirt runs container disks as ephemeral root volumes. Prefer images with cloud-init for Linux.
Sources:
| Name | Image |
|---|---|
| Cirros (demo) | quay.io/kubevirt/cirros-container-disk-demo |
| Ubuntu 22.04 | quay.io/containerdisks/ubuntu:22.04 |
| Fedora demo | quay.io/kubevirt/fedora-container-disk-demo |
Register via UI¶
- Select a tenant (root: use the tenant switcher).
- Open Images & Templates (
/templates). - Register image → Container disk or ISO (PVC).
- For container disks: name, display name, image URL, optional
#cloud-configuser-data.
Platform templates show a platform badge and cannot be edited or deleted.
Register via API¶
curl -H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: $TENANT_ID" \
https://iaas.example/api/v1/vm-templates
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: $TENANT_ID" \
-H "Content-Type: application/json" \
-d '{
"name": "ubuntu-2404",
"display_name": "Ubuntu 24.04",
"image": "quay.io/containerdisks/ubuntu:24.04",
"source_type": "container",
"os_type": "linux"
}' \
https://iaas.example/api/v1/vm-templates
| Method | Path | Description |
|---|---|---|
| GET | /api/v1/vm-templates |
Platform + tenant |
| POST | /api/v1/vm-templates |
Create tenant template |
| PATCH | /api/v1/vm-templates/{id} |
Update tenant template |
| DELETE | /api/v1/vm-templates/{id} |
Delete tenant template |
ISO import (CDI)¶
ISO templates download install media into a DataVolume/PVC in the tenant namespace.
Requirements: CDI on the cluster (Helm chart can install it), HTTP(S) ISO URL, RWO StorageClass.
Flow:
- Create template with
source_type: "iso"andimage= ISO URL import_state: importing,state: Inactive- Worker creates CDI HTTP import DataVolume
- Success →
import_state: ready,state: Active - Failure →
import_state: failed
| Field | Default | Description |
|---|---|---|
iso_size_gi |
8 | DataVolume size for the ISO |
boot_disk_size_gi |
32 | Blank boot disk at VM deploy |
storage_class |
cluster default | StorageClass for DataVolumes |
The UI polls every 5s while any template is importing.
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "X-Tenant-ID: $TENANT_ID" \
-H "Content-Type: application/json" \
-d '{
"name": "windows-server-2022",
"display_name": "Windows Server 2022 Eval",
"image": "https://go.microsoft.com/fwlink/?linkid=2195280",
"source_type": "iso",
"iso_size_gi": 8,
"boot_disk_size_gi": 32
}' \
https://iaas.example/api/v1/vm-templates
Warning
You cannot deploy from an ISO template until import_state is ready.
Deploying with templates¶
On VMs, pick a template + service offering. See Virtual machines.