I was eager to try Firecracker after hearing about its release at re:Invent 2018. The microVM technology require access to the hardware; a bare metal server is needed. GCP and AWS both offer bare metal machines. I opted to go with Packet, a company that specializes in bare metal-as-a-service.
You can sign up for an account at Packet that comes with a $25 service credit. Use this to fire up a c1.small.x86 server. I tried using the smaller t1.small.x86 server type but encountered problems. I found available capacity in the EWR1 region.
Firecracker requires a 4.14+ kernel version. I selected Ubuntu 18.04 LTS as the operating system to get a recent kernel. Then off to the races!
Packet’s automation provisions bare metal servers in about a minute.
SSH Window 1
root@firecracker:~# curl -LOJ https://github.com/firecracker-microvm/firecracker/releases/download/v0.11.0/firecracker-v0.11.0 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 610 0 610 0 0 4039 0 --:--:-- --:--:-- --:--:-- 4039 100 6006k 100 6006k 0 0 11.2M 0 --:--:-- --:--:-- --:--:-- 11.2M curl: Saved to filename 'firecracker-v0.11.0' root@firecracker:~# mv firecracker-v0.11.0 firecracker root@firecracker:~# chmod +x firecracker root@firecracker:~# ./firecracker --api-sock /tmp/firecracker.socket
SSH Window 2
root@firecracker:~# curl -fsSL -o hello-vmlinux.bin https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin root@firecracker:~# curl -fsSL -o hello-rootfs.ext4 https://s3.amazonaws.com/spec.ccfc.min/img/hello/fsfiles/hello-rootfs.ext4 root@firecracker:~# curl --unix-socket /tmp/firecracker.socket -i \ > -X PUT 'http://localhost/boot-source' \ > -H 'Accept: application/json' \ > -H 'Content-Type: application/json' \ > -d '{ > "kernel_image_path": "./hello-vmlinux.bin", > "boot_args": "console=ttyS0 reboot=k panic=1 pci=off" > }' HTTP/1.1 204 No Content Date: Wed, 05 Dec 2018 09:52:32 GMT root@firecracker:~# curl --unix-socket /tmp/firecracker.socket -i \ > -X PUT 'http://localhost/drives/rootfs' \ > -H 'Accept: application/json' \ > -H 'Content-Type: application/json' \ > -d '{ > "drive_id": "rootfs", > "path_on_host": "./hello-rootfs.ext4", > "is_root_device": true, > "is_read_only": false > }' HTTP/1.1 204 No Content Date: Wed, 05 Dec 2018 09:52:39 GMT root@firecracker:~# curl --unix-socket /tmp/firecracker.socket -i \ > -X PUT 'http://localhost/actions' \ > -H 'Accept: application/json' \ > -H 'Content-Type: application/json' \ > -d '{ > "action_type": "InstanceStart" > }' HTTP/1.1 204 No Content Date: Wed, 05 Dec 2018 09:52:46 GMT root@firecracker:~#
Now if you return to Window 1, you’ll see the VM’s boot messages and login prompt.
Welcome to Alpine Linux 3.8
Kernel 4.14.55-84.37.amzn2.x86_64 on an x86_64 (ttyS0)
localhost login:
You can access the VM using root/root.
I encourage readers to check out Packet while experimenting with Firecracker. Edge computing is a hot topic and this company has an impressive service.