13 ms·
Converting an old MacBook into an always-on personal Kubernetes cluster
- spalas 7y agoInitially, I tried doing this with a 2010 Mac Mini (which claims to support VMX), but couldn't get Minikube running on it... For the past two weeks though, I haven't had any issues with this setup on the Macbook Air!
- atmosx 7y agoYou could try k3s in the mini. k3s uses a less resource hungry setup, parity is not there yes as many resource definitions won't work out of the box.
- spalas 7y agoInteresting, maybe I'll give that a try! (would be nice since I have 16GB of RAM on the Mini vs 4GB on the MBA and it is better suited to leaving on all the time) When I tried with minikube, the VirtualBox VM would boot successfully, but there was an issue with the networking b/w the VM and MacOS
- josteink 7y ago> which claims to support VMX I though Kubernetes was all about containers, not VMs? Why not just boot proper Linux on that thing?
- kernelsanderz 7y agoI run Linux (latest Kali Linux) on a similar MacBook Air and it work great for any of the light container tasks I've thrown at it (Docker, firecracker-vm, etc)
- jrockway 7y agoYour Kubernetes node itself is Linux, so requires virtualization if your host machine is not Linux. Docker for Mac also works this way; when you run a container, it's running on a Linux VM that Docker sets up, not on your Mac directly. Even on Linux, minikube uses a separate VM. It's just cleaner than having the kubelet running on your workstation directly. (microk8s takes a different approach and runs on your machine directly. The last time I interacted with it, it destroyed my coworker's workstation and we had to reinstall the machine completely. k8s is pretty invasive and really wants an entire machine at its disposal. VMs are just perfect for that.)
- josteink 7y ago> Your Kubernetes node itself is Linux, so requires virtualization if your host machine is not Linux. Thus my question: If the aim is to use the machine for a Kubernetes "cluster", why not boot proper Linux on it, so Kubernetes can run at full speed, without any VM overhead?
- MiroF 7y agoAgreed
- jrockway 7y agoWith processor support for virtualization, the overhead is minimal. I personally use a Windows machine at home (for games, sigh) and run VMs for a Linux development machine and a few k8s nodes for testing. The performance inside the VMs is excellent. I think right now if you want to have a single-node testing cluster, you will be very happy with minikube and the VM it creates. If you want multiple nodes, you will be very happy with VMs; you can create, destroy, and inject errors right from the command-line without having to walk over to physical machines and manipulate them.
- greyskull 7y agoI wonder what it would take to do something like this with kind[0] so you can have something resembling an actual multi-node cluster, if it's even possible. I've used kind successfully on WSL for experimenting locally, and even found a script to open up ports on the firewall and set up a port "forwarding" of sorts using the netsh utility, which let me access a program bound to a port within WSL. Though I suspect additional hurdles considering however the networking for kind works. [0] https://kind.sigs.k8s.io/ https://kind.sigs.k8s.io/
- monadic2 7y agoWhy run windows at all?
- akiselev 7y agoDual booting/VMs might not be practical or worth the effort if you're a gamer or work in one of these fields: mechanical/electrical engineering, firmware, lab or factory automation, architecture, etc.
- tsm212 7y agoI guess the only limiting factor in dual booting would be a lack of skill to set up dual boot. It's quite intimidating at first. I have been dual-booting for ~8 years and I have had my fair share of blunders but nowadays setting up a dual boot pc is very easy especially for the tech savvy (people who are running a k8 cluster) people. I cannot even recall if there was any time where I could restore atleast windows part of the os.
- SifJar 7y agoI don't think it was setting up the dual boot that GP was saying was impractical, more having to constantly reboot to switch back & forth between OSes.
- yjftsjthsd-h 7y agoI don't think it's just a skill thing; multibooting is more surface for "interesting" bugs and annoyances as you force interactions between systems that weren't designed to work together. Sure, you might know how to fix Windows overwriting the bootloader for the nth time, but it's still a hassle. Yes, you know how to get the UEFI settings the way you want them, but if you were single-booting the system would have done it for you. I get that it's not that bad once you're used to it, but there is a cost to these things.
- punnerud 7y agoIf you want to use your own domain you can turn Cloudflare into a DDNS by frequently checking your public-IP for changes and update the records on Cloudflare using their API if it change (this is free, except the domain cost): https://github.com/punnerud/cloudflare-ddns https://github.com/punnerud/cloudflare-ddns
- jyrkesh 7y agoI'm doing exactly this now on an RPi running Docker Swarm. Only difference is that I pay Namecheap for the domain, so Cloudflare is free...I know Swarm is outdated, but it was super easy to start being useful on just one node, now it's running all sorts of things for me. But yeah, it's just a shell script that hits the API every 10 mins.
- candiddevmike 7y agoYou can also use ddclient, it is available on most Linux distributions.
- s-km 7y agoWhat sort of fun projects/experiments do people do with a super low powered k8s cluster locally? I'm kind of in this weird position where I understand the benefits and use of k8s, but I: a) Can't think of any cutesy distributed systems/microservices type thing that I could or would want to run on a low power machine locally (lack of processing power or ISP getting pissed off @ massive amount of traffic if you're e.g. scraping a ton of data and doing stream processing on it in your little cluster) b) Don't really understand the point in investing time in it, as it feels like one of those things you learn on the job as it comes up. And for a lot of people (the majority, probably?) it'll probably never even come up unless they just are hunting for new tech to introduce at work regardless of if the business actually needs it. Which IMO, most businesses don't even have a compelling reason to switch from the old 3 tier monolith architecture.
- twblalock 7y agoOne benefit is to learn how to admin a Kubernetes cluster. Kubernetes knowledge is becoming an important job skill, and if your current employer does not use Kubernetes, you'll need to learn it on your own. > Which IMO, most businesses don't even have a compelling reason to switch from the old 3 tier monolith architecture. Compelling reasons include self-healing, autoscaling, and official support from all major cloud providers. In my experience, it's actually easier to adopt Kubernetes at a smaller company than a larger one. It's also becoming harder to hire developers who are willing to work on monolithic codebases. It's been a while since those were the state of the art, and a lot of people with 5+ years in the industry have never seen them before.
- ForHackernews 7y agoThis sounds a lot like CV-driven development, rather than any actual use cases. That's not to say it's a bad idea for an individual dev, but might not say great things about our industry.
- collyw 7y agoWe have adopted Kubernetes at our startup. It's solved a couple of problems but created a whole lot more. We aren't at the stage that we need the scaling yet.
- fulafel 7y agoAnyone have a theory why they're running OS X on it?
- sgt 7y agoProbably for convenience and stability. Linux on the desktop (or on a laptop) has its share of bugs and odd behavior still in 2020.
- dijit 7y agoDefinitely no more bugs than its contemporaries. But MacOS does handle low memory conditions much better than Windows does. MacOS (on apple hardware) does have the benefit of optimised fan curves and undervolted CPU profiles which would be hard to replicate in Linux though.
- sgt 7y agoWell, I used the word convenience for a reason. I have a MBP running Linux as a server, and it was fiddly to set up correctly. I didn't mind too much, but on macOS you've got none of that. Catering for edge cases like; when closing lid, it should not go to sleep, with external drive connected and mounted, it won't boot if that somehow disappears, Apple remote cannot easily be disabled (there's one used in the room, and it's picked up by the laptop constantly). I also have occasional issues where the trackpad stops working after a period, and requires a reboot to fix. More of an X issue I believe.
- Scramblejams 7y agowith external drive connected and mounted, it won't boot if that somehow disappears Couple ideas, for what little they may be worth. Grub might be installed on the wrong drive. Or, if you’re getting past grub, look up systemd’s nofail option for /etc/fstab.
- sgt 7y ago
- jstewartmobile 7y agomacbook air is a good computer. put it in a drawer. it might still come in handy one day. shitting it up and wearing it down with kubernetes is a guaranteed wrong move.
- DmitryOlshansky 7y agoOr how to elegantly waste a perfectly fine piece of hardware in a neatly over-engineered way ;)
- mosselman 7y agoYou could sell the MacBook and build a decent raspberrypi cluster with the money you make on it.
- mettamage 7y agoOnly a clam seller would come up with that ;-) I like it! ^^
- mosselman 7y agoIt took me a lot longer than I'd like to admit to get what you mean ;)
- rmdashrfstar 7y agoA big problem is local storage provisioner for kubernetes is still not GA. I want to use an SSD attached to one master, and use that as storage for the other RPIs. Doing this is still undocumented/the Wild West.
- mosselman 7y agoI am not a kubernetes expert so I have no idea. Sounds like a fun challenge. I remember seeing something about network mounts for linux in general. Maybe go around kubernetes? If you solve it I'd be interested in how you did it, so an update would be greatly appreciated.
- zimmertr 7y agoKubernetes supports pretty much any type of storage through API Extensions so network mounts are supported. People often use the NFS-Client & NFS-Provisioner projects for this.
- vetinari 7y agoDisclaimer: k8s beginner here. As far as I understand, local storage provisioner is for the node local storage; the storage doesn't follow the workload to whatever node is the pod scheduled, but schedules the pod to the node containing the storage device. It doesn't allow for pods to access local storage outside the node. So for worker nodes using storage on the master node, isn't it better to use either iSCSI or NFS?
- captn3m0 7y agoI used to run minikube on my MBA till last year (Was running Arch). It was very underpowered to run a cluster, as I guess they'll soon find out. This was a MBA 2015, so the OP's 2012 MBA is even less powerful. The fans would start whirring, and the device was immediately unusable for anything else. I switched to using microk8s, which is slightly better, but still makes the device crawls. The MBA also only has 4GB RAM, which is very low on what you might count as k8s-ready.
- bluedino 7y agoInstalling Linux on the MacBook Air would be a huge improvement. Less overhead and not having to use VirtualBox to run Linux anyway... I have an old T460S, I ran VirtualBox on it for a short while, it was so slow it felt like something was wrong.
- mark-wagner 7y agoFrom my experience running a 3 node cluster (as VMs) etcd was a beast in terms of CPU and disk use.
- drceng 7y agoBut we are always at home nowadays…
- wpietri 7y agoFor what it's worth, I built one like this on an old Linux laptop. I then moved my home lighting controller onto it as a test. Some months later my house lights stopped working, and I had to spend a few hours applying snippets semi-randomly from Stack Overflow. It could be the problem was due to expired Kubernetes certificates, or it could be something else. Either way, my conclusion was that Kubernetes is really meant for more scale and attention than I like to give my home infrastructure, so although I enjoyed the experiment, I would encourage people not to run important services on something like this.
- hnarn 7y agoI have a strong feeling that the added complexity of Kubernetes does not give most use cases a net payoff for hobbyists. A lot of the quirks and monkey wrenching with both Docker and Kubernetes seems to be like problems that in many cases were solved in traditional _NIX systems decades ago. I'm sure there are benefits of throwing some of that architecture out for some scenarios but people shouldn't treat it as a new paradigm by default.
- karatestomp 7y agoDocker's been great for hobbyist stuff for me. But I don't really use anything fancy on it, just map some folders for storage I want to survive rebuilds[1] and forward necessary ports to the host machine's interfaces. I don't rely on swarm or any of that. I mostly use it to avoid having to worry about distro-specific crap, since I no longer care to (re-)learn any of that. I don't even use docker-compose since almost none of my personal services depend on one another, just simple shell scripts that all look pretty similar. [1] In some ways this is easier than running traditional daemons, as storage locations for dockerized services tend to be well-documented, prominently, all in one place, and don't change from, say, one package manager to another. You can very easily get all your dockerized services storing their important stuff under one isolated tree, and back up the whole thing. That plus your run scripts are all you need to restore, no matter which host platform you use. [EDIT] in fact, getting Samba set up for my super simple and surely common use case of "I want these folders shared read-only for everyone, and these others writable for this one user" was much easier with Docker than it's been since back when I used Gentoo. The fancier distros all seem to make it a big pain in the ass to do anything other than sharing user directories through the GUI, and change Samba configs between seemingly every major release, and they're always a mess. With the Dockerized version it was one short and sweet arcane magical line per directory I wanted to share, so no clearer, but very short and worked on the first try.
- ivan4th 7y agoFor me there's very good reason for running home k8s cluster: dogfood factor. I run my smarthome and home surveillance (zoneminder) stuff, along with UniFi controller on k8s, and I must say that helps me a great deal with SRE part of my job. I do learn some important things before I encounter them in the work setting, such as: https://twitter.com/ivan4th/status/1236481744477532171 https://twitter.com/ivan4th/status/1236481744477532171
- johnchristopher 7y agoThere are things I don't understand with Kubernetes and the "spin up containers as needed". How do you spin up different databases ? It won't sync, unless your code takes that into account... Say, I have a simple WP site running with a web, a php and a db container... What's the schema to give 2 or 3 more database container and still have visitors see the same content ? (and the databases being consistent) Set up replication ?
- usui 7y agoTo tackle this issue in Kubernetes (specifically for a db), I have created persistent volume claims that are mounted across replicas in a db deployment, with the permission of multiple readers but only one writer. If we know that Postgres stores all its data in /var/x, then we can mount /var/x in all replicas as a shared volume. In terms of the point related to taking into account in your application, as long as you have all the db replicas under one umbrella as a deployment/service, then having one endpoint for the db is fine and it is no concern of the application. Keep in mind I am still learning Kubernetes, but this is what I have done to scale up separate back end components. Are there any objectionable/wrong practices being done?
- q3k 7y agoThis is not the right approach. First, ReadWriteMany implementations (which depend on your cluster) might not guarantee the sort of POSIX filesystem consistency that databases expect. Second, does Postgres in read-only replica expect to be run on a read-only, possibly-changing volume? What's the consistency model then? The standard way of doing this is to run a single postgres instance on a single PVC/PV (that replicates across the cluster anyway), letting the cluster move the pod if it dies. In addition, you can run read-only postgres replicas for some semblance of read-only HA while the master reschedules on failure. You can also go deeper into faster failover mechanisms (without having the k8s scheduler in the hot path of that) using any of the tons of postgres HA systems.
- aliswe 7y agoFrom what I understand thos is what you need kubernetes database operators for. They configure the database cluster for you.
- bluedino 7y agoAn HP or Dell USFF PC would be a great alternative. Something like an OptiPlex 7010 or 800 G2. You can pick them up for $50 used, if you need more power you can add as large of an SSD as you want plus 16GB of RAM, they're small and quiet and can run Linux.
- dangus 7y agoYes but this cost the author $0
- api 7y agoWorks just as well on any sufficiently powerful old laptop. I find that any damaged laptop or one with a battery that doesn't hold a charge converts nicely into a home or lab server.
- jariel 7y agoWhy would one want a 'personal kube cluster'?
- pantulis 7y agoFor learning purposes, I guess.
- xenophonf 7y agoOr if you want to self-host. I'm not a huge fan of ceding my digital life to the likes of FAANG, even though I use their services a lot. Conversely, running my own infrastructure (DNS, email, etc.) is kind of a pain, and it'd be nice to apply the same kinds of personal force multipliers to my home setup that I use at work (config management, security benchmarks, automatic provisioning, version control, etc.)
- yjftsjthsd-h 7y agoYou're on Hacker News. Playing with fun new technology is 100% a valid "usecase" here:)
- jariel 7y agoYes, of course! Which is why it's a rhetorical question. Many technologies, I can see how people would want to hack on. But Kube, to me, is going way down the rabbit hole - a tech to support another tech, to support another tech, to support another tech, to do maybe something at scale, which few will ever do. I feel as the Kubes is one of those almost entirely arbitrary forms of complexity that pulls our nerdy attention into the netherworld. I feel lately that tech people are creating a fully on dystopia of total complexity: more than any one individual can grasp in a lifetime, and a situation in which it's nary impossible to know even which direction someone should head to be a 'pragmatic contributor' who also has 'some semblance of a life' without woefully falling behind. It's one thing to have enthusiasts, it's another to have a situation wherein only kids coding since 18 and running their own 'kube clusters' and 10-layer stacks at home have the chops to do what's necessary.
- xwdv 7y agoA better thing to do with an old MacBook is using it for an Arcade cabinet. I wish the person who wrote this article described what he did next with this K8s cluster. Probably nothing.
- spalas 7y agoAuthor here -- Something like this? https://www.imore.com/mac-mini-mame-arcade-cabinet-project https://www.imore.com/mac-mini-mame-arcade-cabinet-project (Looks cool! Some time down the line I'll have to try it out) The first thing I did with the setup was to learn about the differences between Helm 2 and Helm 3. I had used Helm 2 in my previous job and wanted to get some hands-on experience with the latest version by installing and modifying some helm charts. This is certainly something that could be accomplished with a similar setup running locally on my primary computer, but I like the reduced (mental) activation energy of always having it ready to go.
- viro 7y agoAm I the only person that gets bugged when people use the word cluster for a single computer?
- aliswe 7y agoSame with groups, no?
- Spivak 7y agoIf I take a physical machine, install ESXi on it, spin up three VMs, install etcd on them, and join them together I have a cluster. If it's instead three etcd processes in the same VM it's still a cluster. If you evacuate two of the processes and allow a single node to maintain quorum it's still a cluster. "I always get bugged when people use the word array to refer to an array of length 1."
- brian_herman__ 7y agoShould I do this to my 2009 macbook?
- spalas 7y agoI don't think the CPU will support virtualization to use this approach. You might be able to install Linux directly and then using something like https://microk8s.io/ https://microk8s.io/ instead...
- fortran77 7y agoI've had bad luck keeping laptops powered 24/7 for months or years. The battery always swells and fails.
- teejmya 7y agoYes, this is inevitable if you're going to run this plugged in over a significant amount of time. Should remove the battery. I found no mention of this in the article, which I think is dangerous. Unfortunately I didn't find any way to contact the author on his site (except an unused comment plugin).
- spalas 7y agoHi -- Author here. Thanks for the word of warning. I'll take a look at removing the battery to avoid any issues.
- Terretta 7y agoI wouldn't change your setup based on anecdata. For instance, my MacBooks tend to be in use 5 - 10 years because they get handed down, and I essentially only run MacBooks while they're plugged in (e.g., off power less than one day a week), and have never had that happen. I certainly see battery capacities drop after 3 years or more, and simply buy a new battery. OWC "MacSales" batteries: https://eshop.macsales.com/shop/Apple/Laptop/Batteries https://eshop.macsales.com/shop/Apple/Laptop/Batteries
- teejmya 7y agoI'm glad you haven't had this issue before, but I'm willing to bet that the (admittedly not often) time you spend unplugged has prevented it. I've run several laptops as you describe without issue, however I've also run two macbooks at two different times plugged in 24/7 as "servers" and both had this issue within 3 years. The first of these two shattered the glass trackpad which was a safety issue in itself. Apple agreed and fixed it for free even though the warranty had expired! This happened to one of my Dell laptops last week since it had been docked for a year and already had a worn battery. So that's why it was fresh on my mind when I commented. Luckily I caught it because the plastic case bent upwards...