VM mass production with libvirt/virt-manager

It can be tempting to use fancy tools like XEN, VMware or Proxmox - but these tools also come with additional requirements, overhead and quite a large documentation.

And while these specialized tools can simplify complex infrastructures, the setup shouldn't delay the first milestone: a working host that quickly spawns new VMs.
Choosing the simplest tool for the job helps to reach a stable milestone faster.

A stable state can be upgraded quicker than a feature-rich state that doesn't work.

Almost bare metal: KVM

Even though container would use less resources, VMs are a bit easier to work with. I'm going with KVM, QEMU, libvirt and virt-manager on a Ubuntu Bionic LTS host.

I'm prefer a universal Ubuntu host over a specialized hypervisor/OS - like Xen or oVirt(which requires RedHat/CentOS) - simply because I know Ubuntu and the OS is still fully accessible(to install stuff in parallel).

Virt-manager doesn't look fancy, but gets the job done - and the
documentation at RedHat is great.

apt install -y virt-manager

Installation is simple: sudo apt install -y virt-manager installs everything needed.

Shortcut: skipping dedicated DHCP/DNS

Setting up a special subnet, nameserver or even VLAN can be fun - but 10 VMs won't kill the home router.

This does depend on the internet connection, but typically a internet service provider does supply/require some sort of router which usually has DHCP and DNS enabled by default - why not just use these in the beginning?!

The AVM FritzBox router is the default ISP router in Germany and meets the requirements. It also provides the local domainfritz.box which - isn't pretty, but - works out of the box. The main goal is to get started quickly -ssh $name.fritz.box is fine. 

At the time the homelab requires a dedicated DNS/DHCP a global configuration management tool like Puppet should be in place anyway.

Meme: It is always DNS

Bonus TIL: The FritzBox doesn't handle duplicate hostnames very well. Check DNS and remove duplicates manually.

Building bridges

To use the existing DHCP server, all VMs require full network access - which isn't the default in most cases. Libvirt comes with a NAT network by default, which is nice to not interfere with the existing network, but it makes things complicated: NAT would require thinks like port-forwarding on the host and a reverse-proxy for web servers - maybe later.

For now, each VM should get it's IP directly via DHCP from the router - direct access via port 22 from anywhere within the network.

Nice side effect: This setup only requires 5 lines in the netplan configuration.

Comments