Firecracker
OPS works well with Firecracker from AWS. OPS doesn't currently interact with the firecracker api but can produce disk images for you to use with firecracker.
To run:
./firecracker --api-sock /tmp/firecracker.socket --config-file vm_config.jsonYou should replace the kernel.img file with the location of your kernel and the my_img.img with the unikernel disk image of choice:
The vm_config.json:
{
"boot-source": {
"kernel_image_path": "/home/eyberg/.ops/nightly/kernel.img",
"boot_args": "console=ttyS0 reboot=k panic=1 pci=off"
},
"drives": [
{
"drive_id": "rootfs",
"path_on_host": "/home/eyberg/.ops/images/g",
"is_root_device": true,
"is_read_only": false
}
],
"network-interfaces": [
{
"iface_id": "eth0",
"guest_mac": "AA:FC:00:00:00:01",
"host_dev_name": "tap0"
}
],
"machine-config": {
"vcpu_count": 1,
"mem_size_mib": 1024
},
"logger": {
"log_path": "log.fifo",
"level": "Info",
"show_level": true,
"show_log_origin": true
}
}You should have a dhcp listener. You can create a bridge and a dhcp server by running:
If you are running via ops we'll create and attach the tap device for you but or firecracker you'll need to Create a tap device:
and you should see the unikernel snag an ip:
If you would like diagnostic logs you can try this before turning on the vm:
boot.sh:
drives.sh:
machine.sh:
start.sh:
Logs
logs.sh:
Finally read your logs:
read_fifo.sh:
Ballooning
For the most current documentation please see https://github.com/firecracker-microvm/firecracker/blob/main/docs/ballooning.md .
Nanos now has ballooning support for firecracker which utilizes mmio transport vs pci with qemu.
To use it with firecracker you'll need to add an appropriate section in your config:
Then you may poll using something like this:
You may inflate or deflate the balloon by sending a PATCH request:
Configuration
You can now dynamically re-configure your unikernel via the firecracker kernel boot_args line such as adding tracing support:
or you could set a static ipv4:
or set an env var:
or set arbitrary arguments:
Known Limitations
Note the following limitations when running workloads under Firecracker. These are not Nanos limitations but limitations imposed via Firecracker because of its unique setup:
(A lot of this has to do with the lack of PCI but that is one of the reasons why it boots much faster.)
No GPU support.
No MQ (multi-queue) taps.
No Volume hot-plugging.
Note: If you're interested in using something like firecracker but need GPU support check out https://www.cloudhypervisor.org/
Last updated
Was this helpful?