Files
harmony/examples/kvm_vm_examples

KVM VM Examples

Demonstrates creating VMs with various configurations using harmony's KVM module. These examples exercise the same infrastructure primitives needed for the full OKD HA cluster with OPNsense, control plane, and workers with Ceph.

Prerequisites

A working KVM/libvirt setup:

# Manjaro / Arch
sudo pacman -S qemu-full libvirt virt-install dnsmasq ebtables
sudo systemctl enable --now libvirtd
sudo usermod -aG libvirt $USER
# Log out and back in for group membership to take effect

Scenarios

Scenario VMs Disks NICs Purpose
alpine 1 1x2G 1 Minimal VM, fast boot (~5s)
ubuntu 1 1x25G 1 Standard server setup
worker 1 3 (60G+100G+100G) 1 Multi-disk for Ceph OSD
gateway 1 1x10G 2 (WAN+LAN) Dual-NIC firewall
ha-cluster 7 mixed 1 each Full HA: gateway + 3 CP + 3 workers

Usage

# Deploy a scenario
cargo run -p kvm-vm-examples -- alpine
cargo run -p kvm-vm-examples -- ubuntu
cargo run -p kvm-vm-examples -- worker
cargo run -p kvm-vm-examples -- gateway
cargo run -p kvm-vm-examples -- ha-cluster

# Check status
cargo run -p kvm-vm-examples -- status alpine

# Clean up
cargo run -p kvm-vm-examples -- clean alpine

Environment variables

  • HARMONY_KVM_URI: libvirt URI (default: qemu:///system)
  • HARMONY_KVM_IMAGE_DIR: where disk images and ISOs are stored