I ported Kubernetes to the browser(ngrok.com) |
I ported Kubernetes to the browser(ngrok.com) |
Won't comment on the product because not my cup of tea.
I'm team cli ftw :)
2. ...would need a renderer, right? Otherwise what does it mean to be "ported to the browser"?
To use an analogy - if somebody ported DOOM to the browser, that means I can now play it in the browser. But I can't really run those databases that it shows in the browser tab, can I?
I couldn't say spin up ruby2d and suddenly have client-side Ruby support. It would require all sorts of custom work to get that actually running in a browser tab.
Where presumably with typical backend container services they really can port around and run anywhere.
So I don't see the point, and someone correct me if I'm wrong but it doesn't even seem to be what it asserts.
It’s not running real container images. Maybe a better idea is simulated Kubernetes.
What’s ported is the control plane: scheduler, kube-proxy, deployment controller, etc, transliterated from the actual Go source and tested against k3s for behavioral parity using the same client API. The “rendering” is the demo app visualizing pod-to-pod requests as moving dots.
Just a misleading title, I think.
It's not "k8s ported to the browser" so much as a web based monitoring tool.
Looks great, btw.
The thing I think is most misleading about the title is that I haven’t ported _all_ of Kubernetes. It’s just the slice I needed. I’m hoping to gradually port more of it, though.
If someone said they "ported git to the browser" but it was just a UI for git workflows it would be equally misleading.
I think because that isn't what "porting" is.
In such a case I would expect git - the version control code and diffing - running in browser JavaScript in the same way DOOM is when someone says they ported DOOM to the browser.
That's what porting means, right?
Since there are k8s bindings written in languages like Node.js (effectively a port) - and even they don't call it "a port" is worth considering for OP with regards to the title! Just my 2c
My understanding is that the interesting part of k8s is how it orchestrates containers, which this port can do a lot of. Your comments imply that a core component of k8s is actually running containers (rather than orchestrating them), but I don't think that's right. That would be the job of containerd or the operating system, depending at what level you're looking at. Happy to be corrected if I'm wrong about any of this!
To call it a port that doesn’t actually work? Idk seems like a baseline requirement.
It’s like saying you ported YouTube to a calculator but it doesn’t play videos because the most interesting part is the search algorithm, and it’s for educational purposes not functionality.
That just isn’t a port.
That would mean I could run an image of an OS like Linux in browser JavaScript. It's a wild thing, but that's what porting literally means! And what I expected with that title.
Think of like a PlayStation emulator... the game itself does not need to be ported - just as if you really made a k8s port you would not really need to reinvent Linux in JS, only be able to run it
A PSX emulator can be said to have been ported (e.g. Tomb Raider has been ported to the browser even though it relies on underlying C++) because it ultimately runs fully 1:1 in a web page. It's a port as far as I'm concerned.
But a k8s port that doesn't do what k8s does isn't a port IMO
K8s sits on top of those and orchestrates them.
It would be the most pointless emulator ever.
And it wouldn’t qualify as being ported IMO
You seem to think it's like a virtual machine, and it lets you run containers anywhere regardless of operating system or host machine. This is not correct. You can't run containers using k8s directly on a Mac, for example, because there is no Linux kernel to run the container. You need a VM first, then you can run k8s inside of that VM. Kubernetes does not let you magically run a container with ARM binaries on an x86 machine either. You would need additional tools to run binaries for another architecture.
You're totally right that in practice, you usually don't need to think about the host OS when you're using k8s. It is nice to not worry about what packages it has installed, etc. But it is not a tool that allows you to run an arbitrary container anywhere.
mAnY lAyERs aside if it doesn’t actually do anything you have not ported anything.
It has to WORK to be a port.
See the PlayStation emulator example - same thing. The game itself is not ported but it still runs. That’s the point!
You might consider reflecting on this long thread which seems to be solely about your personal definition of the word "port", and arguing with others that the definition should be what you say.
Particularly because you're now stooping to insulting other HN posters over one technical definition of one word.
> 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.
plus a re-implementation of the CNI and a container runtime.
I may have alluded to that experience - in saying that we used to use VMs for the same use case (isolation) before mainstream containerization like Docker. But yeah I know the two are unrelated.
The idea of installing software in an isolated (emulated) environment - a snapshot of the OS ("disk image") - is not so different from the PSX emulator analogy since emulators also work that way.
Docker got popular before Kubernetes was even created. It was after the fact that it became its own thing, and tried to become just an "orchestration layer" but it means nothing without containerization.
To say you ported it to the browser with no working containers doesn't mean anything to me. What was ported?
It's like saying you ported PlayStation to Chrome but no games will play. How is it a port of anything.
That is not happening here. This is a simulation of a web based kubernetes control plane.
The whole point of the movement toward Docker/kubernetes is that you can run services anywhere without needing a 1:1 OS/physical machine configured for that service. It's an evolution on hijacking VMs for this use case. Consider what this technology is, and is for.
To say it has been ported to the browser would mean I could run e.g. postgres service in my browser the same way installing kubernetes on some cloud provider lets me run it there without having access to that machine directly.
He hasn't ported kubernetes to a browser. If I use some cloud provider UI to configure kubernetes I would not say that k8s is running in that browser tab. I'd just be using a web based dashboard.
Yes it can visualize activity, logs, etc. but kubernetes is not actually provisioning, managing state, scheduling, etc. in its environment (the browser) the way it did in an OS environment. And correct me if I'm wrong - but it's not even calling out to other environments - these are mere simulations of services that aren't running anywhere. Aren't they?
It wouldn't be impossible to do what the title implies is happening - See JSLinux to actually see Linux in a browser. It aint pretty, but that's the kind of thing I'd think of if somebody said they ported kubernetes to the browser. I should be able to run stuff there.
No amount of whining is going to change anything.
The only thing that would change my opinion is if it actually worked.
And I don't think I was being insulting at all.
What I replied to:
"pretty clear you don't know well enough what you are talking about" is the real insult in this thread, which is what I called out :) Those statements are so boring and don't prove anything. Anyone can say "You don't know what you are talking about" but he hasn't proven anything. It's just an empty insult.
Making letters lower/upper to stress emphasis in a reply to that is part of conveying that.
You haven't changed my mind at all so far, I still think this doesn't qualify as a port.
Question for you: What would you use this project for in production? How could I replace k8s today with this browser port?
> You haven't changed my mind at all so far, I still think this doesn't qualify as a port.
as it turns out, I'm not actually interested in debating over the meaning of a word, or convincing anyone to change their mind on it
> K8s sits on top of those and orchestrates them.
> I'm not actually interested in debating over the meaning
Ok.
Did you know that k8s came after containerization, and means nothing without it
Though it seems like right now this is probably better for conceptual/architectural education. The real fun is when you start learning to master kubectl.
I’m hoping this offers an alternative. It has the risk of becoming out of date with reality, but at least even in that case the core should ~always be relevant.
For example i built this https://kubernetes-made-simple.vercel.app/
Now i can add this
Its a cool site btw
Kube rapidly becomes accidental complexity when you use it to accomplish things that could be done more simply, of course.
It was fun.
As a minor thought / question – I'm a little surprised that this isn't (yet) wired up for pods to run in Web workers.
I appreciate that there is a Clock mechanism (allowing you to step the cluster), which would be more difficult in that setup, but... I feel like especially with SharedArrayBuffer (which admittedly requires the right COOP/COEP), that could be pulled off with atomics.
Would be very cool to be able to actually thread in earnest with this design!
One of the fun things is it shouldn’t be too difficult to create a new RuntimeService that uses web workers and slots in alongside my existing CRI. I’d love a PR along those lines!
Similarly, when you move on to doing Volumes support, the browser's OPFS APIs can be synchronous from workers and only async from the main thread, so there are interesting possibilities around buffering/caching/using SharedArrayBuffer to accept-and-write extents that could be nice with workers. :)
If I get a spare moment, I'll absolutely take a look at PR-ing a runtime!
For a while I have wanted to make a web page where you can do service load balancing and queuing simulations so this would be a great basis for it.
https://samwho.dev/load-balancing https://encore.dev/blog/queueing
I bet you just meant to share prior art and not be discouraging, Sam. But just saying :-)
Recently I also started to port fd.io vpp to rust for my app with help of codex
A clear interface and well defined test case is must to make the rewrite successful
>Right now, it doesn’t support ConfigMaps, Secrets, pod resources, persistent volumes, and a whole host of other things I haven’t needed yet. As I make more content with this library, I’ll implement more of what I need.
Yea, this is initial start to the madness followed by Ingress Controller and all little weird crazy stuff that Developers do that drive our lives crazy.
Also keeping these plates spinning while 100 devs are launching who knows what.
etcd is not a requirement of k8s, plenty of clusters out there use non-etcd stores. E.g. k3s/k3d can use sqlite, all of the big cloud providers use their own in-house datastores instead of etcd.
> Is this just slop?
> Almost all of the webernetes code was authored by LLMs
> ...
> I did two things that I think make this a slop-free project:
> 1. I reviewed every line of code.
> 2. I created hundreds of tests that assert webernetes behaves the same as a real cluster.
edit: added the slop-free remarksalso the title is false
But then, I get the idea of the project. If you wanted real kubernetes, it's easy to install on any OS or online in a VM.
There has to be some cutoff of features where "it runs in the browser" makes sense. I think the project has made a good call here.
To address the earlier comment: I didn’t go down the “implement the OS-level stuff required to get k8s to compile to wasm” path due to bundle size, honestly and truly. My testing indicated it could be over 10Mb, and I didn’t want that if I could avoid it. Turns out, I could avoid it.
Whether it’s a bad idea remains to be seen. It could be! The project will never have full parity with k8s, and as k8s moves forward I probably won’t keep up. But I think the core of k8s is stable enough that that’s okay, and I can make great content about the bits that don’t change.
it's a bad faith dig at ai-driven development, not the part of the comment that was supposed to be taken seriously, sorry.
Many projects would be just fine if you created a comprehensive-enough set of tests that you understood to be enough.
>I'll often encourage BACKEND JAVASCRIPT DEVS to try to solve computer problems themselves by trial and error.
>However I've learned an important lesson: if they say the've sold their problem, never ask how.
1. Bun rewritten in Rust
2. Flow rewritten in Rust
3. The react compiler was rewritten in Rust
4. Grit is a new implementation of Git in Rust
5. I've made my own rust rewrite of postgres that passes 100% of the regression and isolation tests[0][1]
I think AI changed the economics of these projects even more than it has the economics for software engineering work in general. Though direct AI code translation is usually slop for me.One of the many things I did to deal with this was an audit skill that would:
1. Find a small chunk of code to rewrite
2. Have a list of things that it was looking for in each piece of code that's being rewritten
3. Place that next to the code being translated
4. If that document didn't exist and/or didn't say the code was passing the audit, code wouldn't be merged
5. As I found problems and anti-patterns I would add those to the skill over time
This by itself still let a lot of slop slip through, but also preemptively caught a ton of issues as part of my overall process.Complicated old "boring" infra software might actually be the most AI-rewriteable code right now
I was thinking for all of these that the end goal is to take some existing technology and add some novel features rather than just X in Rust so what I have so far.
1. The Lua project bundles Lua 5.1 - 5.5 in one binary and one npm package so it's easy to run in the browser or CloudFlare Worker etc.
2. The Valkey (Redis) port builds something called EdgeStash - lets you run Valkey with Lua scripting in a CloudFlare Durable Object programmable with Lua scripting.
https://edgestash-valdr.ianmclaughlin1398.workers.dev/ that's a demo of the Edge Valkey node running.
I've been meaning to take take it and do something like yours that is sweet!
Volumes are one of those things that I’m quite sure won’t be that difficult to implement but I don’t have a need for them in the near future, so likely won’t support them for a good while.
Let's take something like GML 5.2 that is open source - anyone can run it on NVIDIA or AMD chips. People are currently making money by running GLM 5.2 Nvidia and AMD chips and selling inference on aggregators like openRouter.
So the cost to serve is like cost of Chip or financing for Chip + power and rackspace somewhere. We basically know that each year you will be able to server exponentially more inference per $ on Nvidia and AMD hardware as it gets to newer generations, so why would you expect the cost of inference on open models to also increase?
Like let's say not through a Chinese subsidized provider but like BaseTen https://www.baseten.co/pricing/ why would that get more expensive year over year?
I'm talking specifically about US-based AI companies / hardware companies and their circular investments and their customer-facing pricing.
> We basically know that each year you will be able to server exponentially more inference per $ on Nvidia and AMD hardware as it gets to newer generations, so why would you expect the cost of inference on open models to also increase?
Because the cost of training continues to increase while getting increasingly harder and harder to make gains. On top of that, there is the delay between investing in the datacenters, staff, running the training, operational costs of customer use, etc and actually recouping profit via customer sales. Your costs go up because their costs go up. Likely even more so now because of the increased risk the US Gov will shut down sales and use of their newest models. That risk will get bundled in with pricing.
I feel like your conflating some general skepticism around the trillion dollar valuation of the US majors and their business model with the topic at hand - large scale C to Rust conversions and similar.
There's a limit to price hikes due to competition, and open weights can't collude so closed weight companies don't have that much wiggle room to raise prices unless they are much better than open weights.
Unless you say you have the best model in the world, and then everybody will fight to use it.
> No, they don't, they can also be defaulted on/written off.
Bye, bye world economy.
The topic at hand wasn't rust conversions, it was token cost.
Effectively token cost for most in the US is whatever the companies and US Gov say it is... Until it pops because they have no real moat.