Hacker News

Tabernetes: A Kubernetes cluster whose nodes are browser tabs

Comments

A Kubernetes cluster whose nodes are browser tabs. Open the page and your phone is a node. The scheduler sends it a pod, and the pod's program runs on a Linux kernel booted in the tab. Close the tab and the node is gone, and Kubernetes starts the pod on someone else's.

Scan to become a node, or use the browser you are reading this in. Joining downloads about 5 MB and runs a small Linux guest in the tab, on one core, until you close the tab.

Topology

The control plane in the middle, a node for each tab, and each Service on the way to the pods behind it. A node is filled when its pod is running. An orange dot is a request you sent, on its way to the pod that answered, and a green one is a tile of the picture on its way to the node that rendered it.

Boot time

How long a tab takes to start its pod: from the tab being handed the pod to the pod's program running, which is the page loading, the kernel booting and the image being mounted.

The last 0 starts. No pod has started yet.

Request latency

How long the cluster takes to answer: from the agent handing a request to the Service to the answer being back from a pod in someone's tab, timed on the cluster's machine.

The last 0 requests, from every visitor, by the milliseconds each took. No request has been answered yet.

Ask the cluster

Send a request to a Service. One of the pods behind it answers, on whoever's phone that is, and counts the visit in a Redis on someone else's.

Render a picture

Press the button and the cluster draws a Mandelbrot set. The picture is split into 64 tiles, and each node's pod computes its share in awk, on the Linux in its tab. Point at a tile to see which device drew it. One picture at a time, for everyone.

Services

The cluster's Services that have a pod on a tab behind them, read from the API server.

Happening now

Nothing yet. A tab that joins shows up here.

The fleet

What the nodes are, by what their browsers say.

The nodes

| Node | Device | Browser | Near | Pod | Boot | Carried | Age |
|---|---|---|---|---|---|---|---|
| No tab is a node right now. Yours can be the first. |

How it works

  • A tab joins. The join page holds a socket open to an agent beside the API server, and the agent registers a Node for the tab.
  • The scheduler sends a pod. The agent starts the pod's container with tabc, a container runtime whose containers run in browser tabs.
  • The tab boots Linux. A kernel compiled to WebAssembly runs the pod's program on the tab's CPU and memory. The pod's files and its address stay on the cluster's machine.

A pod asks for a tab in one line

The control plane is an ordinary Kubernetes, and a pod is an ordinary pod. The marked line is the only one that is new: the scheduler puts a pod that has it on a tab, and every other pod on the cluster's own machine.

apiVersion: v1
kind: Pod
metadata:
  name: hello
spec:
  runtimeClassName: tab
  containers:
  - name: hello
    image: alpine
    command: ["sh", "-c", "echo hello from $(uname -m) in a tab; sleep 3600"]
Read on Hacker News ↗ ← Back to News

Comments

No comments yet. Start the discussion.