Skip to content

Hardware Acceleration (Optional)

DroidFarm's cuttlefish-qemu backend works on any standard Kubernetes node without modification. This page documents how to enable KVM hardware acceleration for faster boot times.

Skip this page if you are using emulationBackend: cuttlefish-qemu (the default).


When to use KVM acceleration

Setting emulationBackend: cuttlefish in your DeviceTemplate reduces boot time from approximately 5–10 minutes to approximately 60 seconds by using the node's KVM hardware. This is useful for:

  • Large CI pipelines where boot time directly affects wall-clock duration
  • Clusters where all emulator nodes are already KVM-capable bare metal or nested-virt VMs
  • Production farms running hundreds of concurrent devices

Required kernel modules

modprobe vhost_vsock vhost_net vsock

Verify they are loaded:

lsmod | grep -E "vhost|vsock"

Expected output:

vhost_vsock            24576  0
vsock                  45056  1 vhost_vsock
vhost_net              32768  0
vhost                  53248  2 vhost_vsock,vhost_net

Required devices

Device Purpose
/dev/kvm Hardware-accelerated virtualization
/dev/vhost-net Cuttlefish networking
/dev/vhost-vsock VM socket communications
/dev/vsock Guest-host communication

Node label

Nodes must be labeled so emulator pods can be scheduled onto KVM-capable nodes:

kubectl label node <node-name> kvm=true

Automated setup

The node-setup DaemonSet handles this automatically when deployed via Helm. It runs scripts/node-setup.sh on every node matching the node selector.

Manual equivalent:

scripts/node-setup.sh

Cloud provider options

Provider Instance type Notes
AWS c6i.metal, c6g.metal Bare metal required for KVM
GCP N2 with --enable-nested-virtualization Nested virt flag at VM creation
Azure NVv4 series Nested virtualization supported
Hetzner ax41-nvme (dedicated) /dev/kvm available on dedicated servers
On-premise Any x86-64 or ARM64 with VT-x/VT-d Most modern servers work

Resource sizing for KVM nodes

Each emulator pod using cuttlefish (KVM) requests:

Resource Minimum Recommended
CPU 2 cores 4 cores
Memory 4 Gi 8 Gi
KVM 1 1

These are enforced by the LimitRange deployed in droidfarm-system.

Verify device plugin

After deploying, confirm the device plugin exposed KVM resources to the node:

kubectl describe node <node-name> | grep -A5 "Allocatable"

You should see:

Allocatable:
  squat.ai/kvm:   1
  squat.ai/vhost: 3