Skip to content

Clusters

One machine is the simple start. When it is not enough, boxfork runs on Kubernetes, and one control service puts many machines and clusters behind one address. Your code does not change.

boxfork on clusters, in 76 seconds: a drain, a move with the files, and a placement by label. The runs in the film are on kind clusters.

This page is for you if one machine is not enough, or if your team already runs Kubernetes. At the end, you will know:

  • the parts of boxfork on Kubernetes
  • what happens to a sandbox when its node goes away
  • how one address can reach many machines and clusters

On Kubernetes, you install boxfork as a Helm chart, and your clients do not change: the chart serves the same HTTP API as the daemon. The chart has four parts:

  • The operator makes one gVisor pod for each Sandbox object.
  • The API service speaks the HTTP API of the daemon, so the SDKs, the CLI and the MCP server work with no change.
  • The node agent runs on each node and saves the files of a sandbox for snapshots, forks and moves.
  • A registry keeps the images of the snapshots.

Because each sandbox is a Kubernetes object, a team can also create sandboxes with kubectl and GitOps. A fork can start on a different node from its parent.

node 1drainednode 2sbx_q4m2/work/hello.txtsame ID, same files
A drain moves each sandbox to a different node. The ID and the files stay. The processes start again, as after a snapshot.

A node goes out of use for an upgrade or a repair, and its sandboxes must not go with it. So when you drain a node, the operator moves each sandbox on it to a different node, under the same ID. The node agent saves the files, and the next pod starts from them.

The move keeps each write that the client saw succeed, because the sandbox stays paused from the save to the end of the move. But the processes stop: like a snapshot, a move keeps the files only.

Two runs show the time it takes:

  • On a kind cluster with two worker nodes, kubectl drain moved 4 sandboxes in 15 seconds, and no write that the client saw succeed was lost.
  • On three Google Cloud VMs with k3s, a drain moved 2 sandboxes with their files in 18 seconds.

When you have many machines or clusters, boxfork-control puts them all behind one address, with one API key. Your code then sends each request to one place, and the control service finds the right machine:

  • Each daemon or cluster joins the control service and opens the connections itself, so it needs no open port.
  • A label such as region=eu chooses where a new sandbox runs.
  • Each request for a sandbox goes to the cluster of that sandbox.
  • If the control service stops, the sandboxes continue to run.
from boxfork import Sandbox
cpu = Sandbox.create(placement={"cloud": "aws"})
gpu = Sandbox.create(gpu=1, placement={"region": "europe-west4"})

A daemon ignores the placement, so the same code works with one daemon and with the control service.

  • A managed cloud cluster, the cluster autoscaler and Karpenter in a live run.
  • GPU nodes on Kubernetes: the API service on Kubernetes refuses a sandbox with a GPU.
  • The control service across two machines or a real network: its runs were on one computer.