Replacing Kubernetes with systemd (2024)

(blog.yaakov.online)

258 points | by birdculture 12 hours ago ago

142 comments

  • drivenextfunc 11 hours ago ago

    I share the author's sentiment completely. At my day job, I manage multiple Kubernetes clusters running dozens of microservices with relative ease. However, for my hobby projects—which generate no revenue and thus have minimal budgets—I find myself in a frustrating position: desperately wanting to use Kubernetes but unable to due to its resource requirements. Kubernetes is simply too resource-intensive to run on a $10/month VPS with just 1 shared vCPU and 2GB of RAM.

    This limitation creates numerous headaches. Instead of Deployments, I'm stuck with manual docker compose up/down commands over SSH. Rather than using Ingress, I have to rely on Traefik's container discovery functionality. Recently, I even wrote a small script to manage crontab idempotently because I can't use CronJobs. I'm constantly reinventing solutions to problems that Kubernetes already solves—just less efficiently.

    What I really wish for is a lightweight alternative offering a Kubernetes-compatible API that runs well on inexpensive VPS instances. The gap between enterprise-grade container orchestration and affordable hobby hosting remains frustratingly wide.

    • rollcat 11 minutes ago ago

      I've been using Docker swarm for internal & lightweight production workloads for 5+ years with zero issues. FD: it's a single node cluster on a reasonably powerful machine, but if anything, it's over-specced for what it does.

      Which I guess makes it more than good enough for hobby stuff - I'm playing with a multi-node cluster in my homelab and it's also working fine.

    • sweettea 11 hours ago ago

      Have you seen k0s or k3s? Lots of stories about folks using these to great success on a tiny scale, e.g. https://news.ycombinator.com/item?id=43593269

      • acheong08 41 minutes ago ago

        I use k3s. With more than more master node, it's still a resource hog and when one master node goes down, all of them tend to follow. 2GB of RAM is not enough, especially if you also use longhorn for distributed storage. A single master node is fine and I haven't had it crash on me yet. In terms of scale, I'm able to use raspberry pis and such as agents so I only have to rent a single €4/month vps.

      • rendaw 4 hours ago ago

        I tried k3s but even on an immutable system dealing with charts and all the other kubernetes stuff adds a new layer of mutability and hence maintenance, update, manual management steps that only really make sense on a cluster, not a single server.

        If you're planning to eventually move to a cluster or you're trying to learn k8s, maybe, but if you're just hosting a single node project it's a massive effort, just because that's not what k8s is for.

      • horsawlarway 8 hours ago ago

        I'm laughing because I clicked your link thinking I agreed and had posted similar things and it's my comment.

        Still on k3s, still love it.

        My cluster is currently hosting 94 pods across 55 deployments. Using 500m cpu (half a core) average, spiking to 3cores under moderate load, and 25gb ram. Biggest ram hog is Jellyfin (which appears to have a slow leak, and gets restarted when it hits 16gb, although it's currently streaming to 5 family members).

        The cluster is exclusively recycled old hardware (4 machines), mostly old gaming machines. The most recent is 5 years old, the oldest is nearing 15 years old.

        The nodes are bare Arch linux installs - which are wonderfully slim, easy to configure, and light on resources.

        It burns 450Watts on average, which is higher than I'd like, but mostly because I have jellyfin and whisper/willow (self hosted home automation via voice control) as GPU accelerated loads - so I'm running an old nvidia 1060 and 2080.

        Everything is plain old yaml, I explicitly avoid absolutely anything more complicated (including things like helm and kustomize - with very few exceptions) and it's... wonderful.

        It's by far the least amount of "dev-ops" I've had to do for self hosting. Things work, it's simple, spinning up new service is a new folder and 3 new yaml files (0-namespace.yaml, 1-deployment.yaml, 2-ingress.yaml) which are just copied and edited each time.

        Any three machines can go down and the cluster stays up (metalLB is really, really cool - ARP/NDP announcements mean any machine can announce as the primary load balancer and take the configured IP). Sometimes services take a minute to reallocate (and jellyfin gets priority over willow if I lose a gpu, and can also deploy with cpu-only transcoding as a fallback), and I haven't tried to be clever getting 100% uptime because I mostly don't care. If I'm down for 3 minutes, it's not the end of the world. I have a couple of commercial services in there, but it's free hosting for family businesses, they can also afford to be down an hour or two a year.

        Overall - I'm not going back. It's great. Strongly, STRONGLY recommend k3s over microk8s. Definitely don't want to go back to single machine wrangling. The learning curve is steeper for this... but man do I spend very little time thinking about it at this point.

        I've streamed video from it as far away as literally the other side of the world (GA, USA -> Taiwan). Amazon/Google/Microsoft have everyone convinced you can't host things yourself. Even for tiny projects people default to VPS's on a cloud. It's a ripoff. Put an old laptop in your basement - faster machine for free. At GCP prices... I have 30k/year worth of cloud compute in my basement, because GCP is a god damned rip off. My costs are $32/month in power, and a network connection I already have to have, and it's replaced hundreds of dollars/month in subscription costs.

        For personal use-cases... basement cloud is where it's at.

        • rcarmo an hour ago ago

          How do you deal with persistent volumes for configuration, state, etc? That’s the bit that has kept me away from k3s (I’m running Proxmox and LXC for low overhead but easy state management and backups).

          • acheong08 41 minutes ago ago

            Longhorn.io is great.

        • sciencesama 7 hours ago ago

          Do you have documentation somewhere, where you can share ?

          • risson 7 hours ago ago

            I do things somewhat similarly but still rely on Helm/customize/ArgoCD as it's what I know best. I don't have a documentation to offer, but I do have all of it publicly at https://gitlab.com/lama-corp/infra/infrastructure It's probably a bit more involved than your OP's setup as I operate my own AS, but hopefully you'll find some interesting things in there.

        • merb 4 hours ago ago

          You should look into fluxcd this stuff makes a lot of stuff even simpler.

      • mikepurvis 10 hours ago ago

        Or microk8s. I'm curious what it is about k8s that is sucking up all these resources. Surely the control plane is mostly idle when you aren't doing things with it?

        • mdaniel 8 hours ago ago

          There are 3 components to "the control plane" and realistically only one of them is what you meant by idle. The Node-local kubelet (that reports in the state of affairs and asks if there is any work) is a constantly active thing, as one would expect from such a polling setup. The etcd, or it's replacement, is constantly(?) firing off watch notifications or reconciliation notifications based on the inputs from the aforementioned kubelet updates. Only the actual kube-apiserver is conceptually idle as I'm not aware of any compute that it, itself, does only in response to requests made of it

          Put another way, in my experience running clusters, in $(ps auwx) or its $(top) friend always show etcd or sqlite generating all of the "WHAT are you doing?!" and those also represent the actual risk to running kubernetes since the apiserver is mostly stateless[1]

          1: but holy cow watch out for mTLS because cert expiry will ruin your day across all of the components

      • Seattle3503 9 hours ago ago

        How hard is it to host a Postgres server on one node and access it from another?

        • jasonjayr 6 hours ago ago

          I deployed CNPG (https://cloudnative-pg.io/ ) on my basement k3s cluster, and was very impressed with how easy I could host a PG instance for a service outside the cluster, as well as good practices to host DB clusters inside the cluster.

          Oh, and it handles replication, failover, backups, and a litany of other useful features to make running a stateful database, like postgres, work reliably in a cluster.

        • rad_gruchalski 8 hours ago ago

          It’s Kubernetes, out of the box.

    • Alupis 10 hours ago ago

      > Kubernetes is simply too resource-intensive to run on a $10/month VPS with just 1 shared vCPU and 2GB of RAM

      I hate sounding like an Oracle shill, but Oracle Cloud's Free Tier is hands-down the most generous. It can support running quite a bit, including a small k8s cluster[1]. Their k8s backplane service is also free.

      They'll give you 4 x ARM64 cores and 24GB of ram for free. You can split this into 1-4 nodes, depending on what you want.

      [1] https://www.oracle.com/cloud/free/

      • lemoncucumber 9 hours ago ago

        One thing to watch out for is that you pick your "home region" when you create your account. This cannot be changed later, and your "Always Free" instances can only be created in your home region (the non-free tier doesn't have that restriction).

        So choose your home region carefully. Also, note that some regions have multiple availability domains (OCI-speak for availability zones) but some only have one AD. Though if you're only running one free instance then ADs don't really matter.

      • mulakosag 3 hours ago ago

        I recenlty wrote a guide on how to create a free 3 node cluster in Oracle cloud : https://macgain.net/posts/free-k8-cluster . This guide currently uses kubeadm to create 3 node (1 control plane, 2 worker nodes) cluster.

      • waveringana 10 hours ago ago

        the catch is: no commercial usage and half the time you try to spin up an instance itll tell you theres no room left

        • SOLAR_FIELDS 10 hours ago ago

          That limitation (spinning up an instance) only exists if you don't put a payment card in. If you put a payment card in, it goes away immediately. You don't have to actually pay anything, you can provision the always free resources, but obviously in this regard you have to ensure that you don't accidentally provision something with cost. I used terraform to make my little kube cluster on there and have not had a cost event at all in over 1.5 years. I think at one point I accidentally provisioned a volume or something and it cost me like one cent.

        • Alupis 10 hours ago ago

          > no commercial usage

          I think that's if you are literally on their free tier, vs. having a billable account which doesn't accumulate enough charges to be billed.

          Similar to the sibling comment - you add a credit card and set yourself up to be billed (which removes you from the "free tier"), but you are still granted the resources monthly for free. If you exceed your allocation, they bill the difference.

          • SOLAR_FIELDS 8 hours ago ago

            Honestly I’m surprised they even let you provision the resources without a payment card. Seems ripe for abuse

            • dizhn 3 hours ago ago

              A credit card is required for sign up but it won't be set up as a billing card until you add it. One curious thing they do is though, the free trial is the only entry way to create a new cloud account. You can't become a nonfree customer from the get go. This is weird because their free trial signup is horrible. The free trial is in very high demand so understandably they refuse a lot of accounts which they would probably like as nonfree customers.

            • mdaniel 8 hours ago ago

              I would presume account sign up is a loss leader in order to get ~spam~ marketing leads, and that they don't accept mailinator domains

              • SOLAR_FIELDS 6 hours ago ago

                They also, like many other cloud providers, need a real physical payment card. No privacy.com stuff. No virtual cards. Of course they don’t tell you this outright, because obscurity fraud blah blah blah, but if you try to use any type of virtual card it’s gonna get rejected. And if your naïve ass thought you could pay with the virtual card you’ll get a nice lesson in how cloud providers deal with fraud. They’ll never tell you that virtual cards aren’t allowed, because something something fraud, your payment will just mysteriously fail and you’ll get no guidance as to what went wrong and you have to basically guess it out.

                This is basically any cloud provider by the way, not specific to Oracle. Ran into this with GCP recently. Insane experience. Pay with card. Get payment rejected by fraud team after several months of successful same amount payments on the same card and they won’t tell what the problem is. They ask for verification. Provide all sorts of verification. On the sixth attempt, send a picture of a physical card and all holds removed immediately

                It’s such a perfect microcosm capturing of dealing with megacorps today. During that whole ordeal it was painfully obvious that the fraud team on the other side were telling me to recite the correct incantation to pass their filters, but they weren’t allowed to tell me what the incantation was. Only the signals they sent me and some educated guesswork were able to get me over the hurdle

                • fishtacos 3 hours ago ago

                  >No privacy.com stuff. No virtual cards.

                  I used a privacy.com Mastercard linked to my bank account for Oracle's payment method to upgrade to PAYG. It may have changed, this was a few months ago. Set limit to 100, they charged and reverted $100.

                • gosub100 2 hours ago ago

                  > send a picture of a physical card and all holds removed immediately

                  So you're saying there's a chance to use a prepaid card if you can copy it's digits onto a real looking plastic card? Lol

      • rfl890 8 hours ago ago

        There are tons of horror stories about OCI's free tier (check r/oraclecloud on reddit, tl;dr: your account may get terminated at any moment and you will lose access to all data with no recovery options). I wouldn't suggest putting anything serious on it.

        • jwrallie 20 minutes ago ago

          They will not even bother sending you an email explaining why, and you will not be able to ask it, because the system will just say your password is incorrect when you try to login or reset it.

          If you are on free tier, they have nothing to lose, only you, so be particular mindful of making a calendar note for changing your CC before expiration and things like that.

          It’s worth paying for another company just for the peace of mind of knowing they will try to persuade you to pay before deleting your data.

        • SOLAR_FIELDS 6 hours ago ago

          Are all of those stories related to people who use it without putting any payment card in? I’ve been happily siphoning Larry Ellisons jet fuel pennies for a good year and a half now and have none of these issues because I put a payment card in

        • thegeekpirate 8 hours ago ago

          Can confirm (old comment of mine saying the same https://news.ycombinator.com/item?id=43215430)

    • thenewwazoo 11 hours ago ago

      > I'm constantly reinventing solutions to problems that Kubernetes already solves—just less efficiently.

      But you've already said yourself that the cost of using K8s is too high. In one sense, you're solving those solutions more efficiently, it just depends on the axis you use to measure things.

      • randallsquared 8 hours ago ago

        The original statement is ambiguous. I read it as "problems that k8s already solves -- but k8s is less efficient, so can't be used".

    • eigengrau 3 hours ago ago

      It’s been a couple of years since I’ve last used it, but if you want container orchestration with a relatively small footprint, maybe Hashicorp Nomad (perhaps in conjunction with Consul and Traefik) is still an option. These were all single binary tools. I did not personally run them on 2G mem VPSes, but it might still be worthwhile for you to take a look.

      It looks like Nomad has a driver to run software via isolated fork/exec, as well, in addition to Docker containers.

    • 404mm 10 hours ago ago

      I found k3s to be a happy medium. It feels very lean and works well even on a Pi, and scales ok to a few node cluster if needed. You can even host the database on a remote mysql server, if local sqlite is too much IO.

    • osigurdson 6 hours ago ago

      Podman is a fairly nice bridge. If you are familiar with Kubernetes yaml, it is relatively easy to do docker-compose like things except using more familiar (for me) K8s yaml.

      In terms of the cloud, I think Digital Ocean costs about $12 / month for their control plane + a small instance.

    • melodyogonna 33 minutes ago ago

      For $10 you can buy VPS with a lot more resources than that on both Contabo and Ovh

    • aequitas 3 hours ago ago

      I've ran K3s on a couple of Raspberry Pi's as a homelab in the past. It's lightweight and ran nice for a few years, but even so, one Pi was always dedicated as controller, which seemed like a waste.

      Recently I switched my entire setup (few Pi's, NAS and VM's) to NixOS. With Colmena[0] I can manage/update all hosts from one directory with a single command.

      Kubernetes was a lot of fun, especially the declarative nature of it. But for small setups, where you are still managing the plumbing (OS, networking, firewall, hardening, etc) yourself, you still need some configuration management. Might as well put the rest of your stuff in there also.

      [0] https://colmena.cli.rs/unstable/

    • nvarsj 10 hours ago ago

      Just do it like the olden days, use ansible or similar.

      I have a couple dedicated servers I fully manage with ansible. It's docker compose on steroids. Use traefik and labeling to handle reverse proxy and tls certs in a generic way, with authelia as simple auth provider. There's a lot of example projects on github.

      A weekend of setup and you have a pretty easy to manage system.

      • nicce 10 hours ago ago

        What is the advantage of traefik over oldschool Nginx?

        • c0balt 9 hours ago ago

          Traefik has some nice labeling for docker that allows you to colocate your reverse proxy config with your container definition. It's slightly more convenient than NGINX for that usecase with compose. It effectively saves you a dedicated vietualhost conf by setting some labels.

          One can read more here: https://doc.traefik.io/traefik/routing/providers/docker/

          This obviously has some limits and becomes significantly less useful when one requires more complex proxy rules.

        • gonzo41 9 hours ago ago

          There's very little advantage IMO. I've used both. I always end up back at Nginx. Traefik was just another configuration layer that got in the way of things.

    • singron 9 hours ago ago

      NixOS works really well for me. I used to write these kinds of idempotent scripts too but they are usually irrelevant in NixOS where that's the default behavior.

      • lewo an hour ago ago

        And regarding this part of the article

        > Particularly with GitOps and Flux, making changes was a breeze.

        i'm writing comin [1] which is GitOps for NixOS machines: you Git push your changes and your machines fetch and deploy them automatically.

        [1] https://github.com/nlewo/comin

    • daitangio 2 hours ago ago

      I developed a tiny wrapper around docker compose which work on my use case: https://github.com/daitangio/misterio

      It can manage multiple machine with just ssh access and docker install.

    • nullpoint420 8 hours ago ago

      Have you tried nixOS? I feel like it solves the functional aspect you're looking for.

    • pachevjoseph 8 hours ago ago

      I’ve been using https://www.coolify.io/ self hosted. It’s a good middle ground between full blown k8s and systemd services. I have a home lab where I host most of my hobby projects though. So take that into account. You can also use their cloud offering to connect to VPSs

    • turtlebits 6 hours ago ago

      I'm a cheapskate too, but at some point, the time you spend researching cheap hosting, signing up and getting deployed is not worth the hassle of paying a few more $ on bigger boxes.

    • CoolCold 5 hours ago ago

      6$/m - will likely bring you peace of mind - Netcup hosting VPS 1000 ARM G11

          6 vCore (ARM64)
          8 GB RAM
          256 GB NVMe
    • alex5207 3 hours ago ago

      > I'm stuck with manual docker compose up/down commands over SSH

      Out of curiosity, what is so bad about this for smaller projects?

    • czhu12 10 hours ago ago

      This is exactly why I built https://canine.sh -- basically for indie hackers to have the full experience of Heroku with the power and portability of Kubernetes.

      For single server setups, it uses k3s, which takes up ~200MB of memory on your host machine. Its not ideal, but the pain of trying to wrangle docker deployments, and the cheapness of hetzner made it worth it.

    • vrosas 9 hours ago ago

      Why not just use something like Cloud Run? If you're only running a microVM deploying it there will probably be at or near free.

    • investa 10 hours ago ago

      SSH up/down can be scripted.

      Or maybe look into Kamal?

      Or use Digital Ocean app service. Got integration, cheap, just run a container. But get your postgres from a cheaper VC funded shop :)

    • BiteCode_dev an hour ago ago

      The solution to this is to not solve all the problems a billion dollar tech does on a personnal project.

      Let it not be idempotent. Let it crash sometimes.

      We lived without kubs for years and the web was ok. Your users will survive.

    • kartikarti 10 hours ago ago

      Virtual Kubelet is one step forward towards Kubernetes as an API

      https://github.com/virtual-kubelet/virtual-kubelet

    • rcarmo an hour ago ago

      What about Portainer? I deploy my compose files via git using it.

    • hkon 10 hours ago ago

      I've used caprover a bunch

  • godelski 5 hours ago ago

    Systemd gets a lot of hate but it really solves a lot of problems. People really shouldn't dismiss it. I think it really happened because when systemd started appearing on distros by default people were upset they had to change

    Here's some cool stuff:

      - containers
    
        - machinectl: used for controlling:
    
          - nspawn: a more powerful chroot. This is often a better solution than docker. Super lightweight. Shares kernel
    
          - vmspawn: when nspawn isn't enough and you need full virtualization
    
        - importctl: download, import, export your machines. Get the download features in {vm,n}spawn like we have with docker. There's a hub, but it's not very active
    
      - homed/homectl: extends user management to make it easier to do things like encryption home directories (different mounts), better control of permissions, and more
    
      - mounts: forget fstab. Make it easy to auto mount and dismount drives or partitions. Can be access based, time, triggered by another unit (eg a spawn), sockets, or whatever
    
      - boot: you can not only control boot but this is really what gives you access to starting and stopping services in the boot sequence. 
    
      - timers: forget cron. Cron can't wake your machine. Cron can't tell a service didn't run because your machine was off. Cron won't give you fuzzy timing, do more complicated things like wait for X minutes after boot if it's the third Sunday of the month and only if Y.service is running. Idk why you'd do that, but you can!
    
      - service units: these are your jobs. You can really control them in their capabilities. Lock them down so they can only do what they are meant to do.
    
        - overrides: use `systemctl edit` to edit your configs. Creates an override config and you don't need to destroy the original. No longer that annoying task of finding the original config and for some reason you can't get it back even if reinstalling! Same with when the original config changes in an install, your override doesn't get touched!!
    
    It's got a lot of stuff and it's (almost) all there already on your system! It's a bit annoying to learn, but it really isn't too bad if you really don't want to do anything too complicated. But in that case, it's not like there's a tool that doesn't require docs but allows you to do super complicated things.
    • rollcat 2 minutes ago ago

      The only issue I'm having with systemd is that it's taking over the role of PID 1, with a binary produced from an uncountable SLOC, then doing even more song and dance to exec itself in-place on upgrades. Here's a PID 1 program that does 100% of all of its duties correctly, and nothing else:

          #define _XOPEN_SOURCE 700
          #include <signal.h>
          #include <unistd.h>
          int main() {
              sigset_t set;
              int status;
              if (getpid() != 1) return 1;
              sigfillset(&set);
              sigprocmask(SIG_BLOCK, &set, 0);
              if (fork()) for (;;) wait(&status);
              sigprocmask(SIG_UNBLOCK, &set, 0);
              setsid();
              setpgid(0, 0);
              return execve("/etc/rc", (char *[]){ "rc", 0 }, (char *[]){ 0 });
          }
      
      (Credit: https://ewontfix.com/14/)

      You can spawn systemd from there, and in case anything goes wrong with it, you won't get an instant kernel panic.

    • gwd 20 minutes ago ago

      > Systemd gets a lot of hate but it really solves a lot of problems.

      From my perspective, it got a lot of hate in its first few years (decade?), not because the project itself was bad -- on the contrary, it succeeded in spite of having loads of other issues, because it was so superior. The problem was the maintainer's attitude of wantonly breaking things that used to work just fine, without offering any suitable fixes.

      I have an old comment somewhere with a big list. If you never felt the pain of systemd, it's either because you came late to the party, or because your needs always happened to overlap with the core maintainer's needs.

    • holuponemoment 4 hours ago ago

      Nice list, I'd add run0 as the sudo replacement.

      My only bugbear with it is that there's no equivalent to the old timeout default you could set (note that doas explicitly said they won't implement this too). The workaround is to run it in `sudo -i` fashion and not put a command afterwards which is reasonable enough even though it worked hard against my muscle memory + copypaste commands when switching over.

      > Systemd gets a lot of hate

      I'd argue it doesn't and is simply another victim of loud internet minority syndrome.

      It's just a generic name at this point, basically all associated with init and service units and none of the other stuff.

      https://man.archlinux.org/man/run0.1.en

      • godelski 3 hours ago ago

        Oh yes, please add more! I'd love to see what others do because frankly, sometimes it feels like we're talking about forbidden magic or something lol

        And honestly, I think the one thing systemd is really missing is... people talking about it. That's realistically the best way to get more documentation and spread all the cool tricks that everyone finds.

          > I'd argue it doesn't 
        
        I definitely agree on loud minority, but they're visible enough that anytime systemd is brought up you can't avoid them. But then again, lots of people have much more passion about their opinions than passion about understanding the thing they opine about.
    • blueflow an hour ago ago

      Then you have that machine that only runs an sshd and apache2 and you still get all that stuff shoehorned into your system.

  • kaylynb 8 hours ago ago

    I've run my homelab with podman-systemd (quadlet) for awhile and every time I investigate a new k8s variant it just isn't worth the extra hassle. As part of my ancient Ansible playbook I just pre-pull images and drop unit files in the right place.

    I even run my entire Voron 3D printer stack with podman-systemd so I can update and rollback all the components at once, although I'm looking at switching to mkosi and systemd-sysupdate and just update/rollback the entire disk image at once.

    The main issues are: 1. A lot of people just distribute docker-compose files, so you have to convert it to systemd units. 2. A lot of docker images have a variety of complexities around user/privilege setup that you don't need with podman. Sometimes you need to do annoying userns idmapping, especially if a container refuses to run as root and/or switches to another user.

    Overall, though, it's way less complicated than any k8s (or k8s variant) setup. It's also nice to have everything integrated into systemd and journald instead of being split in two places.

  • abhisek 2 hours ago ago

    I think you are only looking at Kubernetes for running and updating container images. If that’s the use-case then I guess it’s overkill.

    But Kubernetes does much more in terms of providing the resources required for these containers to share state, connect to each other, get access to config or secrets etc.

    That’s where comes the CPU and memory cost. The cost of managing your containers and providing them the resources they need.

    > basically acts as a giant while loop

    Yep. That’s the idea of convergence of states I guess. In a distributed system you can’t always have all the participating systems behave in the desired way. So the manager (or orchestrator) of the system continuously tries to achieve the desired state.

  • masneyb 11 hours ago ago

    The next step to simplify this even further is to use Quadlet within systemd to manage the containers. More details are at https://www.redhat.com/en/blog/quadlet-podman

    • al_borland 9 hours ago ago

      This was touched on at the end of the article, but the author hadn't yet explored it. Thanks for the link.

      > Of course, as my luck would have it, Podman integration with systemd appears to be deprecated already and they're now talking about defining containers in "Quadlet" files, whatever those are. I guess that will be something to learn some other time.

    • rsolva 10 hours ago ago

      This us the way! Quadlets is such a nice way to run containers, really a set and forget experience. No need to install extra packages, at least on Fedora or Rocky Linux. I should do a write up of this some time...

    • lstolcman 2 hours ago ago

      I encourage you to look into this blog post as well; it helped me greatly with seamlessly switching into quadlets in my homelab: https://news.ycombinator.com/item?id=43456934

    • overtone1000 10 hours ago ago

      I came to the comments to make sure someone mentioned quadlets. Just last week, I migrated my home server from docker compose to rootless podman quadlets. The transition was challenging, but I am very happy with the result.

      • sureglymop 9 hours ago ago

        Seems very cool but can it do all one can do with compose? In other words, declare networks, multiple services, volumes, config(maps) and labels for e.g. traefik all in one single file?

        To me that's why compose is neat. It's simple. Works well with rootless podman also.

        • grimblee 2 hours ago ago

          Look into podlet, it's a tool made to convert compose files, kube manfiests, running containers and maybe other stuff, into quadlets.

          I'm using this tonspeedup my quadlet configs whenever I want to deploy a new service that invariably has a compose file.

        • 0xC0ncord 9 hours ago ago

          You can if you convert your docker-compose.yaml into Kubernetes YAML and deploy that as a quadlet with a .kube extension.

          • sureglymop 2 hours ago ago

            That is indeed really nice. However, kubernetes resource definitions are way more complicated than compose files so I still wish one could do the same by just adding a .compose extension to easily migrate.

  • byrnedo 11 hours ago ago

    I created skate (https://github.com/skateco/skate) to be basically this but multihost and support k8s manifests. Under the hood it’s podman and systemd

  • teleforce 8 hours ago ago

    The article is more than one year old, systemd now even has specialized officially supported OS distro for immutable workflow namely ParticleOS [1],[2].

    [1] ParticleOS:

    https://github.com/systemd/particleos

    [2] Systemd ParticleOS:

    https://news.ycombinator.com/item?id=43649088

  • mdeeks 9 hours ago ago

    From what I read, I think you can replace this all with a docker compose command and something like Caddy to automatically get certs.

    It's basically just this command once you have compose.yaml: `docker compose up -d --pull always`

    And then the CI setup is this:

      scp compose.yaml user@remote-host:~/
      ssh user@remote-host 'docker compose up -d --pull always'
    
    The benefit here is that it is simple and also works on your development machine.

    Of course if the side goal is to also do something fun and cool and learn, then Quadlet/k8s/systemd are great options too!

  • LelouBil 4 hours ago ago

    I don't know if someone knows a better stack for my fleet of self hosted applications, maybe moving to quadlet would simplify stuff ?

    Right now I have an Ansible playbook responsible for updating my services, in a git repo.

    The playbook stops changed services, backups their configs and volumes, applies the new docker-compose.yml and other files, and restarts them.

    If any of them fail to start, or aren't reachable after 3 minutes, it rolls back everything *including the volumes* (using buttervolume, docker volumes as btrfs subvolumes to make snapshots free).

    I am looking into Kubernetes, but I didn't find a single stack/solution that would do all that this system does. For example I found nothing that can auto rollback on failure *including persistent volumes*.

    I found Argo Rollback but it doesn't seem to have hooks that would allow me to add the functionality.

  • fpoling 2 hours ago ago

    At some point I tried to run a few small websites dedicated for activism (couple of Wordpress instances, a forum and custom PHP code) using docker. It was time sink as updating and testing the images turned out to be highly non-trivial.

    Eventually I replaced everything with a script that generated systemd units and restarted the services on changes under Debian using the Wordpress that comes with it. Then I have a test VM on my laptop and just rsync changes to the deployment host and run the deployment script there. It reduced my chores very significantly. The whole system runs on 2GB VPS. It could be reduced to 1GB if Wordpress would officially support SQLite. But I prefer to pay few more euros per month and stick to Mariadb to minimize support requirements.

  • stavros 7 hours ago ago

    I am of the opinion that deploying stuff to a single server shouldn't be this complicated, and I wrote a tool to deploy the way I wanted:

    https://harbormaster.readthedocs.io/

    Harbormaster uses a YAML file to discover repositories, clones and updates them every so often, and runs the Docker Compose files they contain. It also keeps all state in a single directory, so you can easily back everything up. That's it.

    It's by far the easiest and best tool for container orchestration I've come across, if all you need is a single server. I love how the entire config is declared in a repo, I love how all the state is in one directory, and I love how everything is just Compose files, nothing more complicated.

    I know I'm tooting my own horn, I just love it so much.

  • mattbillenstein 9 hours ago ago

    I never moved to containers and seeing the churn the community has went through with all of this complicated container tooling, I'm happy orchestrating small-scale systems with supervisord and saltstack-like chatops deployments - it's just stupid simple by comparison and provides parity between dev and prod environments that's nice.

    • cydmax 8 hours ago ago

      It looks like supervisord had it last release in December 2022. GitHub issue for a new release are not answered: https://github.com/Supervisor/supervisor/issues/1635#issue-2... The original author seems to have moved on to NixOS.

    • mardifoufs 5 hours ago ago

      What churn? For 95% of users, the way to use containers hasn't changed in the past decade. It's just a combination of docker CLI, maybe some docker compose for local testing and then pushing that image somewhere.

    • baggy_trough 9 hours ago ago

      try the built-in systemd containers - via nspawn. Underrated tool!

      • candiddevmike 8 hours ago ago

        Too many gaps around image management. It seems like an unfinished feature that wasn't completely thought out IMO. Podman is what systemd-nspawns OCI interface should've become.

        • MrDrMcCoy 3 hours ago ago

          The incomplete resource controls compared with other units is also annoying. Probably the biggest reason for me that I haven't used nspawn much.

  • grimblee 2 hours ago ago

    For anyone interested in quadlet, I've discovered a very usefull tool to convert compose files and manifests into quadlets: podlet.

    It dramatically speeds up the process of converting the usual provided files into quadlets.

    https://github.com/containers/podlet

  • forty 2 hours ago ago

    I do that too, I run everything in rootless podman managed by systemd units it's quite nice. With systemd network activation I could even save the cost of user space networking, though for my single user use case, it's not really needed and for now I could not bother.

    I also have Quadlet on my backlog, I'm waiting the release of next stable version of Debian (which I think should be released sometimes this year) as the current version of Debian has a podman slightly too old which doesn't include Quadlet

  • thebeardisred 9 hours ago ago

    Funny, because when we built Fleet (https://github.com/coreos/fleet/) Kubernetes didn't exist.

  • zokier 11 hours ago ago

    Why on earth would you run services on a server with --user and then fiddle with lingering logins instead of just using the system service manager?

    • phoronixrly 11 hours ago ago

      I'll answer this for you. You want rootless podman because docker is the defacto standard way of packaging non-legacy software now including autoupdates. I know, sad... Podman still does not offer convenient and mature way for systemd to run it with an unprivileged user. It is the only gripe I've had with this approach...

      • ggpsv 8 hours ago ago

        This is no longer true as of Podman 5 and Quadlet?

        You can define rootless containers to run under systemd services as unprivileged users. You can use machinectl to login as said user and interact with systemctl.

        • jcgl 8 hours ago ago

          Quadlet debuted with Podman 4.4 iirc.

    • soraminazuki 8 hours ago ago

      It appears that systemd User= and DynamicUser= is incompatible with Podman so --user is being used as a replacement. Looks messy.

      https://github.com/containers/podman/discussions/20573

  • arjie 10 hours ago ago

    I also use systemd+podman. I manage the access into the machine via an nginx that reverse proxies the services. With quadlets things will probably be even better but right now I have a manual flow with `podman run` etc. because sometimes I just want to run on the host instead and this allows for me to incrementally move in.

    • sureglymop 9 hours ago ago

      I do this with traefik as the reverse proxy. To host something new, all I need to do is add a label to the new container for traefik to recognize. It's neat with a wildcard cert that traefik automatically renews. I've also heard good things about caddy, a similar alternative.

      • arjie 8 hours ago ago

        Yeah, I've heard that these new reverse proxies are great like that. I have to run certbot (which I do) and I should have created wildcard certs but I didn't. I use traefik on k3s and it's good there for other stuff.

  • klooney 12 hours ago ago

    https://github.com/coreos/fleet I feel like fleet deserved more of a shot than it ultimately got.

    • thebeardisred 9 hours ago ago

      Well, it's funny you mention that because I started working on a PoC of running vLLM atop Fleet this morning. :grin:

      • klooney 3 hours ago ago

        I'm glad to hear it still works!

    • pa7ch 11 hours ago ago

      agreed, coreos pivoted to k8s almost immediately after releaseing fleet and didn't really get the chance to use and develop it much.

  • arevno 9 hours ago ago

    This is cool, but it doesn't address the redundancy/availability aspect of k8s, specifically, being able to re-schedule dead services when a node (inevitably) dies.

    • psviderski 6 hours ago ago

      Generally speaking, redundancy/availability could also be achieved through replication rather than automatic rescheduling, where you deploy multiple replicas of the service across multiple machines. If one of them dies, the other one still continues service traffic. Like in good old days when we didn't have k8s and dynamic infra.

      This trades off some automation for simplicity. Although, this approach may requires manual intervention when a machine fails permanently.

    • pphysch 8 hours ago ago

      I like to look at Kubernetes as "distributed systemd".

      "What if I could define a systemd unit that managed a service across multiple nodes" leads naturally to something like k8s.

  • OptionOfT 4 hours ago ago

    Wrt to the updates: Does it mean it maintains the original environment variables you passed in separate from the ones set by the container?

    E.g. when updating a container with watchtower:

    You deploy a container 'python-something'.

    The container has PYTHON=3.11.

    Now, the container has an update which sets PYTHON=3.13.

    Watchtower will take the current settings, and use them as the settings to be preserved.

    So the next version will deploy with PYTHON=3.11, even though you haven't set those settings.

  • mattrighetti 9 hours ago ago

    Do you actually need the container at that point?

    I host all of my hobby projects on a couple of raspi zeros using systemd alone, zero containers. Haven’t had a problem since when I started using it. Single binaries are super easy to setup and things rarely break, you have auto restart and launch at startup.

    All of the binaries get generated on GitHub using Actions and when I need to update stuff I login using ssh and execute a script that uses a GitHub token to download and replace the binary, if something is not okay I also have a rollback script that switches things back to its previous setup. It’s as simple as it gets and it’s been my go-to for 2 years now.

    • bbkane 5 hours ago ago

      I do this too; but I'm looking to try the container approach when I can't use a single binary (i.e. someone else's Python project).

    • mrbluecoat 5 hours ago ago

      How does your rollback work without containers?

      • eitland 2 hours ago ago

        If it is a single binary, replace the current with the previous.

        If it is deployed as folders, install new versions as whatever.versionnumber and upgrade by changing the symlink that points to the current version to point to the new one.

  • strangus 6 hours ago ago

    I just deployed a couple containers this way, was pretty easy to port the docker-compose. However, I then tried to get them to run rootless, and well, that turned out to be headache after headache. Went back to rootful, other than I'm pretty happy with the deployment.

  • kgeist 9 hours ago ago

    When a service is updated like this:

    - is there downtime? (old service down, new service hasn't started yet)

    - does it do health checks before directing traffic? (the process is up, but its HTTP service hasn't initialized yet)

    - what if the new process fails to start, how do you rollback?

    Or it's solved with nginx which sits in front of the containers? Or systemd has a builtin solution? Articles like this often omit such details. Or no one cares about occasional downtimes?

    • LinuxAmbulance 6 hours ago ago

      Hobbyists care not for such things. Sure does matter at the enterprise level though.

  • dullcrisp 10 hours ago ago

    I’m here just doing docker compose pull && docker compose down && docker compose up -d and it’s basically fine.

    • Aluminum0643 6 hours ago ago

      I believe you can skip the "down" :)

      • chupasaurus 3 hours ago ago

        docker-compose had very unfun mechanism of detecting image updates so it depends (I haven't dug deep into V2).

      • dullcrisp 5 hours ago ago

        Good to know

  • sph 3 hours ago ago

    I remember seeing a project in development that built k8s-like orchestration on top of systemd a couple years ago, letting you control applications across nodes and the nodes themselves with regular systemd config files and I have been unable to find it again. IIRC it was either a Redhat project or hosted under github.com/containers and looked semi-official.

    Anyone knows what I’m talking about? Is it still alive?

    EDIT: it’s not CoreOS/Fleet, it’s something much more recent, but was still in early alpha state when I found it.

  • VWWHFSfQ 11 hours ago ago

    We went back to just packaging debs and running them directly on ec2 instances with systemd. no more containers. Put the instances in an autoscaling group with an ALB. A simple ansible-pull installs the debs on-boot.

    really raw-dogging it here but I got tired of endless json-inside-yaml-inside-hcl. ansible yaml is about all I want to deal with at this point.

    • secabeen 10 hours ago ago

      I also really like in this approach that if there is a bug in a common library that I use, all I have to do is `apt full-upgrade` and restart my running processes, and I am protected. No rebuilding anything, or figuring out how to update some library buried deep a container that I may (or may not) have created.

    • SvenL 11 hours ago ago

      Yes, I also have gone this route for a very simple application. Systemd was actually delightful, using a system assigned user account to run the service with the least amount of privileges is pretty cool. Also cgroup support does really make it nice to run many different services on one vps.

    • r3trohack3r 9 hours ago ago

      The number of human lifetimes wasted on the problem domain of "managing YAML at scale"...

  • xwowsersx 6 hours ago ago

    FYI the link to Flux in

    > Particularly with GitOps and [Flux](https://www.weave.works/oss/flux/?ref=blog.yaakov.online), making changes was a breeze.

    appears to be broken.

    EDIT: oh, I hadn't realized the article was a year old.

  • maxclark 11 hours ago ago

    I know some large AWS environments that run a variation of this

    Autoscaling fleet - image starts, downloads container from registry and starts on instance

    1:1 relationship between instance and container - and they’re running 4XLs

    When you get past the initial horror it’s actually beautiful

  • dorongrinstein 9 hours ago ago

    At https://controlplane.com we give you the power of Kubernetes without the toil of k8s. A line of code gets you a tls terminated endpoint that is geo routed to any cloud region and on-prem location. We created the Global Virtual Cloud that let's you run compute on any cloud, on premises hardware or vm's and any combination. I left vmware to start the company because the cognitive load on engineers was becoming ridiculous. Logs, metrics, tracing, service discovery, TLS, DNS, service mesh, network tunnels and much more - we made it easy. We do to the cloud what vmware did to hardware - you don't care what underlying cloud you're on. Yet you can use ANY backing service of AWS, GCP and Azure - as if they merged and your workloads are portable - they run unmodified anywhere and can consume any combination of services like RDS, Big Query, Cosmos db and any other. It is as if the cloud providers decided to merge and then lower your cost by 60-80%.

    Check it out. Doron

  • lrvick 10 hours ago ago

    Or drop all brittle c code entirely and replace systemd with kubernetes: https://www.talos.dev/

    • weikju 10 hours ago ago

      Just replace the battle tested brittle C code with a brittle bespoke yaml mess!

      • sepositus 9 hours ago ago

        To suggest that Kubernetes doesn't fall under the scope of "battle tested" is a bit misleading. As much as systemd? Of course not. But it's not 2016 anymore and we have billions of collective operational hours with Kubernetes.

        Just the other day I found a cluster I had inadvertently left running on my macBook using Kind. It literally had three weeks of uptime (running a full stack of services) and everything was still working, even with the system getting suspended repeatedly.

        • djhn 3 hours ago ago

          I once discovered that I had left a toy project postgres instance running on my macbook for two and a half years. Everything was working perfectly, and this was more than a decade ago, on an intel mac.

    • nullpoint420 8 hours ago ago

      +1, easiest bare-metal installation of k8s ever.

  • malteg 7 hours ago ago
    • jcgl an hour ago ago

      I ran it for a couple years. While it had some quirks at the time, it (and the rest of the Hashi stack) were lightweight, nicely integrated, and quite pleasant.

      However, it’s no longer open source. Like the rest of Hashicorp’s stuff.

    • tgz 2 hours ago ago

      ... or (maybe) incus.

  • TZubiri 9 hours ago ago

    Looking forward to the follow up "replacing systemd with init and bash scripts."

  • iAm25626 10 hours ago ago

    on the resource part - try running k8s on Talos linux. much less overhead.

  • IAmNotACellist 9 hours ago ago

    That's the most disgusting sentence fragment I've ever heard. I wish it could be sent back in a localized wormhole and float across the table when Systemd was being voted on to become the next so-called init system.

    Edit: Nevermind, I misunderstood the article from just the headline. But I'm keeping the comment as I find the reference funny

  • lstodd 8 hours ago ago

    was actually fun running crypto traders without all this container bullshit. one service is one service. and so much simpler.

    it helped of course that people writing them knew what they were doing.