VM Import Controller

Overview

Designed and implemented a Kubernetes operator to orchestrate large-scale virtual machine migrations from KVM to Harvester. This solution enabled the migration of 100+ VMs β€” a transition that was not operationally feasible without custom orchestration.

Key Achievements

  • πŸš€ 100+ VMs migrated β€” Enabled enterprise-scale virtualization modernization
  • βš™οΈ Custom orchestration β€” Built where no off-the-shelf solution existed
  • πŸ”„ Seamless transitions β€” Zero-downtime migration workflows

Technical Details

The operator implements a sophisticated reconciliation loop that:

  1. Discovers source VMs via SSH connection to KVM/Libvirt hosts
  2. Gracefully powers off source VMs with configurable timeouts
  3. Streams and converts disk images using qemu-img
  4. Creates KubeVirt VirtualMachine CRs with appropriate CPU/memory/network mappings
  5. Tracks migration status via Kubernetes custom resource status fields

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   KVM Source    │────▢│  VM Import       │────▢│   Harvester     β”‚
β”‚   (Libvirt)     β”‚ SSH β”‚  Controller      β”‚     β”‚   (KubeVirt)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technologies

Go Kubernetes Operator SDK KubeVirt Harvester Libvirt QEMU