Skip to main content

API Reference

API Reference – Virtual Machines​

This reference provides an exhaustive description of Hikube's VMInstance and VMDisk APIs: available parameters, default values, usage examples, and recommended best practices.

The fields documented below correspond to the schema actually exposed by the platform (apps.cozystack.io/v1alpha1).


VMInstance​

Overview​

The VMInstance API lets you create, configure, and manage virtual machines in Hikube. A VM relies on one or more disks described separately via the VMDisk resource.

vm-instance.yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: VMInstance
metadata:
name: example-vm
spec:
# Detailed configuration below
Correct Kind

The resource is named VMInstance (not VirtualMachine). The disk is not a built-in systemDisk field: you must create a separate VMDisk resource and reference it in disks.


Full specification​

ParameterTypeDescriptionDefaultRequired
externalbooleanEnables network exposure from outside the clusterfalseno
externalMethodstringExposure method: PortList or WholeIPPortListno
externalPorts[]integerPorts to forward from the outside (used with PortList)[22]no
runStrategystringDesired running state (see runStrategy)Alwaysno
instanceTypestringCPU / memory size (see instance types)u1.mediumno
instanceProfilestringOS profile / preferences (drivers, kernel) β€” see profilesubuntuno
disks[]objectList of VMDisk resources to attach (see disks)[]no
subnets[]objectAdditional subnets (VPC) β€” see subnets[]no
gpus[]objectGPUs to attach in passthrough (see gpus)[]no
resourcesobjectExplicit CPU / memory / sockets override (see resources){}no
cpuModelstringCPU model exposed to the VM (e.g. host-passthrough)""no
sshKeys[]stringInjected public SSH keys[]no
cloudInitstringCloud-init configuration (user-data YAML)""no
cloudInitSeedstringSeed used to generate a stable SMBIOS UUID""no
note

All fields are optional: a minimal VM only requires a bootable disk referenced in disks. The default values above are those applied by the platform.


runStrategy​

runStrategy controls the VM running state. It replaces the former boolean running field.

ValueBehavior
AlwaysThe VM is kept running (restarts automatically if it stops)
HaltedThe VM is stopped
ManualThe state is driven manually (virtctl start / stop)
RerunOnFailureRestarts only after a failure
OnceStarts once, without automatic restart
spec:
runStrategy: Always

To stop/restart an existing VM:

kubectl patch vminstance my-vm --type='merge' -p '{"spec":{"runStrategy":"Halted"}}'
kubectl patch vminstance my-vm --type='merge' -p '{"spec":{"runStrategy":"Always"}}'

Network configuration​

spec:
external: true
externalMethod: PortList
externalPorts:
- 22
- 80
- 443

See Network exposure methods.


Instance types​

instanceType references a VirtualMachineClusterInstancetype. Hikube exposes several series, each with sizes from nano β†’ 8xlarge:

SeriesUsage
s1Standard β€” shared/burstable CPUs, 1:2 vCPU:RAM ratio
u1Universal β€” general purpose, 1:4 ratio (default)
m1Memory optimized β€” 1:8 ratio
# Examples from the Universal series (1:4 ratio)
instanceType: u1.medium # 1 vCPU, 4 GB RAM
instanceType: u1.large # 2 vCPU, 8 GB RAM
instanceType: u1.xlarge # 4 vCPU, 16 GB RAM
instanceType: u1.2xlarge # 8 vCPU, 32 GB RAM
instanceType: u1.4xlarge # 16 vCPU, 64 GB RAM
instanceType: u1.8xlarge # 32 vCPU, 128 GB RAM
# Standard series (1:2 ratio)
instanceType: s1.small # 1 vCPU, 2 GB RAM
instanceType: s1.medium # 2 vCPU, 4 GB RAM
instanceType: s1.large # 4 vCPU, 8 GB RAM
instanceType: s1.xlarge # 8 vCPU, 16 GB RAM
instanceType: s1.2xlarge # 16 vCPU, 32 GB RAM
# Memory optimized series (1:8 ratio)
instanceType: m1.large # 2 vCPU, 16 GB RAM
instanceType: m1.xlarge # 4 vCPU, 32 GB RAM
instanceType: m1.2xlarge # 8 vCPU, 64 GB RAM
instanceType: m1.4xlarge # 16 vCPU, 128 GB RAM
instanceType: m1.8xlarge # 32 vCPU, 256 GB RAM
GPU and instanceType

To attach a GPU, choose a general-purpose series (u1, s1…) and declare the GPU via the gpus field. The NVIDIA driver requires at least 4 GiB of RAM.


OS profiles​

instanceProfile loads the KubeVirt preferences (drivers, machine model, kernel) suited to the OS. It does not define the image β€” that is carried by the VMDisk. It is especially decisive for Windows (virtio drivers).

Available values (excerpt):

FamilyProfiles
Ubuntuubuntu
RHELrhel.7, rhel.8, rhel.9, rhel.10 (+ variants .desktop, .arm64, .dpdk, .realtime)
CentOScentos.7, centos.stream8, centos.stream9, centos.stream10 (+ .desktop, .dpdk)
Fedorafedora, fedora.arm64
openSUSEopensuse.leap, opensuse.tumbleweed
SLESsles
Othersalpine, cirros
Windowswindows.2k22.virtio, windows.2k25.virtio, windows.10.virtio, windows.11.virtio (the .virtio variants are recommended); non-virtio variants are also available (windows.2k22…)
note

There is no dedicated debian, rocky, or almalinux profile. For those distributions, use ubuntu (Debian base) or leave instanceProfile: "". For Windows, always use a .virtio variant (e.g. windows.2k25.virtio) so that the virtio drivers are loaded.


Disks​

disks is a list of objects referencing VMDisk resources by name. The first disk listed is usually the bootable disk.

FieldTypeDescription
disks[].namestringName of the VMDisk to attach
disks[].busstringBus type (virtio, sata, scsi) β€” optional
spec:
disks:
- name: vm-system-disk
- name: vm-data-disk
bus: scsi
warning

The VM does not take a new disk into account until it is restarted (virtctl restart or a runStrategy toggle).


GPU​

gpus attaches one or more NVIDIA GPUs in PCI passthrough.

FieldTypeDescription
gpus[].namestringName of the GPU resource (nvidia.com/...)
spec:
instanceType: u1.2xlarge
gpus:
- name: nvidia.com/AD102GL_L40S

The models available on Hikube are detailed in the GPU API reference. A GPU is assigned exclusively to a single VM.


Subnets​

subnets attaches the VM to additional subnets of a VPC.

FieldTypeDescription
subnets[].namestringSubnet name
spec:
subnets:
- name: subnet-ab2c3e47

Resources​

By default, CPU/memory sizing is carried by instanceType. The resources block lets you explicitly override those values (and define a socket topology).

FieldTypeDescription
resources.cpuint/stringNumber of allocated CPU cores
resources.memoryint/stringAmount of allocated memory
resources.socketsint/stringNumber of CPU sockets (topology)
spec:
resources:
cpu: "4"
memory: 8Gi
sockets: "2"

SSH configuration​

spec:
sshKeys:
- ssh-rsa AAAA... user@host
- ssh-ed25519 AAAA... user2@host

Cloud-init​

spec:
cloudInit: |
#cloud-config
users:
- name: admin
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- ssh-rsa AAAA...
packages:
- htop
- docker.io
# Optional seed to pin the SMBIOS UUID (licensing, machine identity)
cloudInitSeed: ""

Full VMInstance example​

production-vm.yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: VMInstance
metadata:
name: vm-example
spec:
external: true
externalMethod: PortList
externalPorts:
- 22
runStrategy: Always
instanceType: u1.2xlarge
instanceProfile: ubuntu
disks:
- name: vm-system-disk
sshKeys:
- ssh-rsa AAAA...

VMDisk​

Overview​

The VMDisk API manages the virtual disks attached to VMs. It supports several image sources: HTTP, a preloaded Golden Image, or an empty disk.

disk-example.yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: VMDisk
metadata:
name: disk-example
spec:
source:
image:
name: ubuntu-2404
optical: false
storage: 30Gi
storageClass: replicated

Main parameters​

ParameterTypeDescriptionDefaultRequired
storageint/stringDisk size5Giβœ…
storageClassstringStorage classreplicatedβœ…
sourceobjectDisk image source (see below){}no
opticalbooleanOptical disk / ISO (installer)falseno

Image sources​

HTTP / HTTPS source​

spec:
source:
http:
url: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img

Golden Images (Hikube preloaded images)​

Golden Images are system images maintained and preloaded in Hikube, for fast provisioning without an external dependency.

spec:
source:
image:
name: ubuntu-2404

Available images​

NameOperating SystemTypeMin. storage
almalinux-8AlmaLinux 8Cloud11 Gi
almalinux-9AlmaLinux 9Cloud11 Gi
almalinux-10AlmaLinux 10Cloud11 Gi
rocky-8Rocky Linux 8Cloud11 Gi
rocky-9Rocky Linux 9Cloud11 Gi
rocky-10Rocky Linux 10Cloud11 Gi
debian-11Debian 11 (Bullseye)Cloud4 Gi
debian-12Debian 12 (Bookworm)Cloud4 Gi
debian-13Debian 13 (Trixie)Cloud4 Gi
ubuntu-2204Ubuntu 22.04 LTS (Jammy)Cloud4 Gi
ubuntu-2404Ubuntu 24.04 LTS (Noble)Cloud4 Gi
centos-stream-9CentOS Stream 9Cloud11 Gi
centos-stream-10CentOS Stream 10Cloud11 Gi
oracle-8Oracle Linux 8Cloud40 Gi
oracle-9Oracle Linux 9Cloud40 Gi
oracle-10Oracle Linux 10Cloud40 Gi
opensuse-156openSUSE Leap 15.6Cloud1 Gi
opensuse-160openSUSE Leap 16.0Cloud2 Gi
cloudlinux-8CloudLinux 8Cloud8 Gi
cloudlinux-9CloudLinux 9Cloud9 Gi
windows-server-2022Windows Server 2022ISO28 Gi
windows-server-2025Windows Server 2025ISO28 Gi
proxmox-8Proxmox VE 8ISO2 Gi
proxmox-9Proxmox VE 9ISO2 Gi
talos-112Talos Linux 1.12Cloud8 Gi
ISO images

ISO type images (Windows, Proxmox) are installers, not ready-to-use cloud images. Plan for an initial installation through the VNC console. For Windows, see the Install a Windows VM guide.

Empty disk​

spec:
source: {}

An empty disk is useful for additional data volumes.


VMDisk example using a Golden Image​

ubuntu-golden-disk.yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: VMDisk
metadata:
name: ubuntu-system
spec:
source:
image:
name: ubuntu-2404
optical: false
storage: 20Gi
storageClass: replicated

Storage classes​

Hikube exposes several storageClass options based on LINSTOR. For a VM, replicated is recommended.

ClassReplicationEncryptionNotes
local❌❌Node-local storage (default), not resilient
local-encryptedβŒβœ… (LUKS)Local + encrypted
replicatedβœ…βŒSynchronous replication β€” recommended for VMs
replicated-encryptedβœ…βœ… (LUKS)Replicated + encrypted
replicated-asyncβœ… (async)❌Asynchronous replication
replicated-async-encryptedβœ… (async)βœ… (LUKS)Asynchronous replication + encrypted
replicated-async-windowsβœ… (async)❌Variant tailored for Windows disks
replicated-async-windows-encryptedβœ… (async)βœ… (LUKS)Windows variant + encrypted
note

The -windows variants are optimized for Windows VM disks. Encryption (-encrypted) relies on LUKS at the volume level.


Network exposure methods​

PortList​

  • Automatic firewall
  • Only the ports listed in externalPorts are accessible
  • Recommended in production

WholeIP​

  • A dedicated public IP, all ports exposed
  • No network filtering on the platform side
  • Reserve for development or controlled gateways
Security

With WholeIP, the VM is fully exposed to the Internet. An OS-level firewall is mandatory.


Best practices​

Security​

  • SSH key authentication only
  • OS firewall active, PortList rather than WholeIP

Storage​

  • replicated (or encrypted/Windows variants) in production
  • Separate the system disk from data disks

Performance​

  • Match instanceType to the workload, or override via resources
  • For GPUs, plan for β‰₯ 4 GiB of RAM and a suitable CPU/RAM ratio
Recommended architecture

In production, use at least 2 disks (system + data) with replicated storage.