Sam Rose is a Senior Developer Educator at ngrok, focusing on creating content that helps developers get the most out of ngrok.
Last week I released webernetes, a partial port of Kubernetes to TypeScript to make it possible to run clusters in the browser. I ended up generating almost 100,000 lines of code in 552 commits across 629 files. It took me 2 months.
The demo below is a webernetes cluster. It runs entirely in your browser, and it’s genuinely doing much of the same work a real Kubernetes cluster does: pod lifecycles, cluster DNS and networking, container garbage collection, IP allocation, Deployment and ReplicaSet tracking, and more. The blue dots represent pods sending requests to each other.
Interactive Webernetes demo showing HTTP requests moving between three pods from a Deployment across three Kubernetes nodes. A cluster in your browser Reset Pause Starting simulated cluster. node-1 node-2 node-3 Replicas 9 Requests/sec/replica 1
Bookmark this section Wait, what am I looking at?
The question I’ve been getting most often is: “Did you compile Kubernetes to WebAssembly?” The answer is no. A simple “hello, world!” Go program compiled to WebAssembly is ~540KiB gzipped. That alone is already bigger than webernetes, which is ~140KiB gzipped. Compiling all of Kubernetes to WebAssembly would no doubt mean sending megabytes over the wire. I did try to check, but unfortunately there are compile-time errors because Kubernetes calls system-level APIs that aren’t available in the browser.
Instead, webernetes is:
A partial port of Kubernetes’ “kubelet” binary, enough to run pods and probe them.
Ports of several Kubernetes “controllers”: pod scheduler, namespace controller, kube-proxy, deployment controller, and a few more.
A browser-based take on a container network interface (CNI), so pods can talk to each other over a simulated network.
... continue reading