Tabernetes 把每个浏览器标签页变成 K8s 节点

原标题:Tabernetes: A Kubernetes cluster whose nodes are browser tabs
58AI 研判分

Tabernetes 是一个实验性项目,它把每个浏览器标签页注册为 Kubernetes 集群节点:打开页面后,标签页内会启动一个约 5 MB 的 Linux 内核,调度器把 Pod 派发到该标签页执行;关闭标签页后节点消失,Pod 会被自动迁移到其他节点。项目通过自定义 runtimeClassName 接入标准 Pod 定义,并实时展示拓扑、启动耗时与跨节点迁移等指标。

关联知识实体

报道正文

本文目录11 个章节

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.

A QR code for the page that makes a browser a node

Scan to become a node, or use the browser you are reading this in.

Join the cluster

Joining downloads about 5 MB and runs a small Linux guest in the tab, on one core, until you close the tab.

0 nodes now 0 pods running in tabs 0 countries - median boot - cluster age 0 hours of tabs lent 0 pods moved off a closed tab 0 carried between tabs and the machine

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

NodeDeviceBrowserNearPodBootCarriedAge

No tab is a node right now. Yours can be the first.

How it works

  1. 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.
  2. The scheduler sends a pod. The agent starts the pod's container with tabc, a container runtime whose containers run in browser tabs.
  3. 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.

YAML
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"]