Skip to content

Firecracker CTL

Rust Axum REST API for managing Firecracker microVMs. Provides VM lifecycle management (create, poll, destroy) with per-VM timeout enforcement and in-memory state tracking via DashMap.

MethodPathDescription
POST/vm/createCreate and start a microVM
GET/vm/{vm_id}Get VM status
GET/vm/{vm_id}/resultGet stdout/stderr/exit_code after completion
DELETE/vm/{vm_id}Force-terminate a running VM
GET/vmList all VMs
GET/healthService health check
  1. User code arrives via env.CODE in the create request
  2. Code is written to a raw block file (512-byte padded)
  3. Block file attached as second Firecracker drive (/dev/vdb)
  4. Entrypoint passed via boot_args (fc_entrypoint=/usr/bin/python3)
  5. VM init script reads code from /dev/vdb, writes to /tmp/code, execs entrypoint

Pre-built ext4 root filesystems built in-cluster via ArgoCD PostSync hook:

ImageSizeContents
alpine-minimal32 MBAlpine + busybox
alpine-python128 MBAlpine + Python 3.12
alpine-node128 MBAlpine + Node.js

All manifests in apps/kube/firecracker/manifests/:

  • Deploymentfirecracker-ctl with /dev/kvm device plugin, kvm=true node selector
  • Service — ClusterIP on port 9001
  • PVC — 2Gi Longhorn volume for rootfs + vmlinux kernel
  • NetworkPolicy — Ingress from edge-runtime + dashboard proxy only
  • KEDA ScaledObject — minReplicas=1, cron scales to 2 during peak hours
  • Rootfs Init Job — ArgoCD PostSync hook, builds ext4 images in-cluster