VM on Google Compute Engine (GCE) supports nested virtualisation, unlike AWS, and allows to run KVM. We can create a VM on GCE to run and test Firecracker microVM.
Setup GCP Project and Zone
FC_PROJECT=your_name-firecracker
FC_REGION=us-east1
FC_ZONE=us-east1-b
gcloud config set project ${FC_PROJECT}
gcloud config set compute/region ${FC_REGION}
gcloud config set compute/zone ${FC_ZONE}
Create a VM image (Machine Image) able to run KVM
FC_VDISK=disk-ub22
FC_IMAGE=ub22-nested-kvm
gcloud compute disks create ${FC_VDISK} \
--image-project ubuntu-os-cloud \
--image-family ubuntu-2204-lts
gcloud compute images create ${FC_IMAGE} \
--source-disk ${FC_VDISK} \
--source-disk-zone ${FC_ZONE} \
--licenses "https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"
Create the VM
FC_VM=firecracker-vm
gcloud compute instances create ${FC_VM} \
--zone ${FC_ZONE} \
--image ${FC_IMAGE}
Connect to the VM via SSH.
gcloud compute ssh ${FC_VM}
Verify that VMX is enabled, enable KVM
$ grep -cw vmx /proc/cpuinfo
1
$ sudo setfacl -m u:${USER}:rw /dev/kvm
$ [ -r /dev/kvm ] && [ -w /dev/kvm ] && echo "OK" || echo "FAIL"
OK