Webernetes: Porting Kubernetes to the Browser with LLMs

Webernetes: Porting Kubernetes to the Browser with LLMs

Webernetes is a partial port of Kubernetes to TypeScript that allows simulated clusters to run entirely within a web browser. Developed over two months, the project consists of approximately 100,000 lines of code across 629 files, designed specifically to create interactive Kubernetes educational content rather than serving as a production-ready distribution.

Architecture and Implementation

Webernetes is not a WebAssembly compilation of Kubernetes. A standard Go "hello world" compiled to WASM is roughly 540KiB, whereas the entire webernetes package is approximately 140KiB gzipped. The project avoids the system-level API dependencies that prevent a direct WASM compilation of the full Kubernetes codebase.

Core Components

To simulate a cluster environment, webernetes implements several critical Kubernetes primitives in TypeScript:

  • Kubelet Port: A partial implementation of the kubelet binary capable of running and probing pods.
  • Controllers: Ports of the pod scheduler, namespace controller, kube-proxy, and deployment controller.
  • Container Runtime Interface (CRI): A browser-based container runtime that the kubelet interacts with to manage containers.
  • Container Network Interface (CNI): A simulated browser-based network allowing pods to communicate with one another.
  • Cluster API: An interface for applying manifests and watching resources.

Image Management

Because of the size constraints of the browser, webernetes does not pull real images from registries like Docker Hub. Instead, it utilizes a browser-based registry where images are defined via a TypeScript API. Users extend a BaseImage class and implement an exec method to define the container's behavior.

Development Process and LLM Integration

Almost all of the webernetes code was authored by Large Language Models (LLMs). To ensure the project was not "slop" (low-quality, unverified AI output), the developer employed a two-pronged verification strategy: manual review of every line of code and the creation of hundreds of behavioral tests.

Challenges in AI Porting

Despite the speed of LLMs, the developer noted several recurring failures when porting Go code to TypeScript:

  1. Shortcuts: LLMs frequently replaced complex Kubernetes cache implementations (LRU, FIFO, expiring caches) with simple JavaScript Map objects, leading to incorrect behavior.
  2. Over-Engineering: LLMs often invented helper functions not present in the original Go code, which obscured the side-by-side review process.
  3. Omissions: LLMs arbitrarily omitted test cases, particularly when porting Go's table-driven tests.

Verification and Testing

To ensure behavioral parity with real Kubernetes, the developer wrote integration tests that run the same code against both webernetes and a real k3s cluster. This was achieved by using the official kubernetes-client/javascript library, allowing the test harness to swap the backend between a Node environment (k3s) and a headless browser (webernetes).

As of the project's current state, webernetes includes 204 integration tests and 1,855 unit tests, many of which are direct ports from the original Kubernetes Go codebase.

Project Metrics and Resource Consumption

Code Growth

The project saw rapid expansion between April and June 2026. While the final count including comments and demo apps reached ~126k lines, the core TypeScript logic stands at ~100k lines.

Token Usage and Cost

The use of coding agents resulted in massive token consumption, particularly in cached input tokens. In the final week of development, the API-equivalent cost spiked to $1,811.64. This increase was attributed to the use of a "team of agents"—including sub-agents for dependency identification, porting, and reviewing—to implement support for Deployments in the demo application.

Current Limitations

Webernetes is a partial port and currently lacks support for several production Kubernetes features, including:

  • ConfigMaps
  • Secrets
  • Pod resources
  • Persistent volumes

Sources