Running a MicroVM#
This guide walks through deploying demo-ops as a microVM on an existing NixOS host using microvm.nix. This is an alternative to the QEMU approach and is useful when you already have a NixOS machine with spare capacity.
Prerequisites#
Nix installed on your workstation
A NixOS host prepared for microVMs — see MicroVM for the required modules and host setup
Configuration#
Edit nixos/hosts/demo-single-node-microvm.nix:
Set the IP address and gateway for your network
Set
network.prefixLengthif your subnet is not/24Add your SSH public key
Adjust the MAC address if needed
Edit ansible/inventory-microvm.yaml:
Set
ansible_hostto match the VM IPSet
microvm_hostto the hypervisor’s IP
Deployment#
Enter the ansible development shell:
nix develop ./external/business-operations#ansible
Deploy the microVM to the hypervisor host:
ansible-playbook -i ./ansible/inventory-microvm.yaml \
$BO_PLAYBOOKS/deploy-microvms.yaml
This builds the NixOS configuration, installs it on the hypervisor, creates the volumes, and starts the VM.
Verify SSH access:
ssh root@<vm-ip> hostname
Bootstrap the Kubernetes cluster:
ansible-playbook -i ./ansible/inventory-microvm.yaml \
$BO_PLAYBOOKS/bootstrap-existing-machines.yaml
Kick off FluxCD:
ansible-playbook -i ./ansible/inventory-microvm.yaml \
$BO_PLAYBOOKS/bootstrap-cluster.yaml
Result#
You should have a single-node Kubernetes cluster running inside a microVM, with Flux managing the applications.
See First Login for accessing the deployed applications.