[HN Gopher] Show HN: Simplenetes - I replaced Kubernetes with 17...
       ___________________________________________________________________
        
       Show HN: Simplenetes - I replaced Kubernetes with 17k lines of
       shell script
        
       Author : thomasbacklund
       Score  : 124 points
       Date   : 2021-04-01 14:56 UTC (8 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | motoboi wrote:
       | Kubernetes might follow the sad path of spring.
       | 
       | Perfect, complete and too complex.
       | 
       | For big and great applications, spring if the obvious choice. It
       | makes incredible complex and difficult things easy.
       | 
       | But, unfortunately, makes simple and quick applications
       | incredible complex and difficult.
        
         | karmakaze wrote:
         | You can't be talking of Spring Framework!? That's a 2000's
         | solution (in particular Hibernate) trying to stay relevant.
        
           | mixedCase wrote:
           | I don't disagree with your conclusion. But your comment
           | communicates no argument against Spring and how the trade-
           | offs it makes make it a poor option for new projects.
        
             | karmakaze wrote:
             | Anyone with sufficient experience with JPQL and Hibernate
             | will realize their limits and how poorly it works in the
             | latency sensitive transactions we want now. Spring and
             | Hibernate were designed to cache domain 'entities' and
             | manage their dirty state client-side as an optimization.
             | Any time you go want to go near the EntityManager you're
             | hitting this impedance mismatch.
        
               | johnnycerberus wrote:
               | What's the alternative?
        
           | artwr wrote:
           | Asking to learn, but if you were to start a Java application
           | in the following two scenarios: 1) Monolith with some CRUD,
           | API, persistence to a DB + search. 2) Scalable backend with
           | an API, persistence to a DB + some caching
           | 
           | what would you use these days?
        
             | kitd wrote:
             | Anything Java-backend-ish these days, my first 2 stops
             | would be Quarkus [1] or Micronaut [2]. It would need
             | special requirements that those couldn't match to move me
             | to something else.
             | 
             | [1] - https://quarkus.io/ [2] - https://micronaut.io/
        
             | skynet-9000 wrote:
             | A _new_ Java application? Java is getting pretty long in
             | the tooth. You might be better off building on top of Go or
             | Rust, especially for those specific scenarios (Go in
             | particular was designed to build network services.)
        
               | anaganisk wrote:
               | "Lol!", Thats what you would get in response when you
               | tell that to the major enterprise customers.
        
             | oftenwrong wrote:
             | HTTP: javalin
             | 
             | persistence: jooq + postgres
             | 
             | search: postgres full text search
             | 
             | cache: ehcache
        
             | karmakaze wrote:
             | Not in any particular order (choose what fits your team):
             | Kotlin or Java and a lighter framework (e.g. Javalin is to
             | Spring as Sinatra is to Rails, with JDBI), a newer big
             | framework (e.g. Micronaut, maybe Play, others),
             | Phoenix/Elixir, Rails/Ruby+Sorbet, Go with libraries.
             | 
             | Edit: I just did a google search for "Java Framework" and
             | get a lot of useless top-N lists with old content retitled
             | "in 2020" with hits like: Hibernate (not a framework), JSF
             | (JavaServer Faces), GWT (Google Web Toolkit), Struts (The
             | Later Version), DropWizard (seems to have stagnated and
             | docs are all over the place. JDBI was extracted and has a
             | life of its own).
        
           | motoboi wrote:
           | Sorry, I meant "was the obvious choice". But the sad path is
           | exactly that. Great solution. Too complex. Oblivion.
        
       | kristaps wrote:
       | Not April fools judging by github history...
        
         | spamizbad wrote:
         | Was delighted to discover this!
        
         | thomasbacklund wrote:
         | Thank you for noticing! :)
         | 
         | Yeah, this represent a few months of full time work.
        
           | faeyanpiraat wrote:
           | So you've worked on it for like a 1000 hours and shared it
           | for free?
           | 
           | How can you afford this?
        
       | some_random wrote:
       | This is really cool, but is there a real use case for this?
        
         | thomasbacklund wrote:
         | Thanks :)
         | 
         | The real use case is super simple clusters, which could be just
         | 1 node, no etcd, no API (SSH managed), no iptables.
         | 
         | Simplenetes is not a living breathing thing which auto heals it
         | self, it's a deterministic approach where you can see your
         | cluster with all hosts in the git repo which represents the
         | cluster.
         | 
         | Also, it's focused on making local development easy, so you can
         | develop in a micro services architecture straight on your
         | laptop with very quick iterations.
        
           | cat199 wrote:
           | > clusters, which could be just 1 node
           | 
           | Despite whatever the k8s crowd misuses the term to be, 1 node
           | is not a cluster. It might be a single node managed using
           | cluster-capable technologies, but it's still not a cluster.
        
             | yen223 wrote:
             | I am a fan of the two-node cluster - one node to do the
             | work, and the other node to manage the cluster.
             | 
             | Main upside is that I can put Kubernetes on my resume.
        
       | [deleted]
        
       | SomaticPirate wrote:
       | I'm not sure if rewriting applications in bash should be
       | considered an improvement...
       | https://twitter.com/astarasikov/status/568825996532707330?s=...
        
       | mplewis wrote:
       | Most of these source code files are very large. Where should I
       | start reading?
        
       | sleepybrett wrote:
       | This seems like a huge waste of time and effort. I can only hope
       | that it an april fools joke.
        
         | thomasbacklund wrote:
         | Haha :) Well, the learning has been great I can confirm that.
         | My script-fu is on a whole new level now, it was already quite
         | up there after creating Space.sh [1]
         | 
         | Waste of time... Well... Let's not think too much about that.
         | I'm at least a very happy user of this :)
         | 
         | [1] https://github.com/space-sh/space
        
       | [deleted]
        
       | remram wrote:
       | This has been bugging me for a while. Programmers _love_ to
       | reinvent the wheel. There a millions of make(1) clones, key-value
       | stores, etc but I don 't seem to see many projects (even toys) in
       | the "declarative container runners" space. I think it's a shame.
       | 
       | While Kubernetes is hopefully Very Good, it is complicated, and I
       | have often wondered what other approaches would yield (e.g. more
       | imperative ones, because writing admission controllers is not
       | exactly easy). So I'm glad to see people playing around, though I
       | don't know if this amount of bash is healthy or if 17,000 lines
       | is simple.
        
       | aabhay wrote:
       | The amount of vitriol in this comments section is astonishing.
       | Can we not share fun projects without the professional Kubernetes
       | experts thumbing their noses? At the very least, it does seem now
       | like the complexity of K8s's code base is a point of very thin
       | skin for the community.
        
         | thomasbacklund wrote:
         | Thank you aabhay for a nice comment.
         | 
         | Seems like my click-baity title brought out some strong
         | feelings :)
         | 
         | I do actually like Kubernetes. I recommend it to clients, I
         | assess candidates who are to work with it, but I do really
         | think it is a Beast. Because it is.
         | 
         | Kubernetes is like C++, extremely useful but it just keeps
         | growing and nobody really knows all of it.
         | 
         | While Simplenetes is like... Lua, batteries not included, your
         | boss will not approve, it doesnt't hit the buzzspot, but some
         | people will secretely use it and be happy about it.
        
         | nunez wrote:
         | tbf the maintainer of Simplenetes throws an incredible amount
         | of shade against Kubernetes
        
           | balfirevic wrote:
           | Where?
        
             | nunez wrote:
             | - "Let's put the Dev and Ops back into DevOps." -
             | "Simplenetes doesn't go there because that is when DevOps
             | becomes MagicOps." - " You enjoy the simple things in
             | life."
        
               | balfirevic wrote:
               | That's not an "incredible amount of shade".
        
         | debarshri wrote:
         | The whole setup of github project looks like it is a serious
         | attempt.
        
           | corndoge wrote:
           | Woe to ye if hn decides your project is Not Fun
        
           | ay wrote:
           | Anyone taking up 17KLOC of shell script "as is", regardless
           | of how many cool domains it is on, to use in production
           | deserves everything they get subsequently.
           | 
           | It will be a useful learning experience.
           | 
           | The same goes about taking up k8s with no thinking, by the
           | way.
        
       | mlvljr wrote:
       | Now do this with .bat files :)
        
       | [deleted]
        
       | [deleted]
        
       | ogre_codes wrote:
       | At some point, April Fools jokes ceased being funny.
       | 
       | Now I'm trying to figure out if I just got too old to appreciate
       | them, or if the good ones have all been used up.
        
       | yosito wrote:
       | Software developers should be required to have a license to use
       | the word "simple".
        
         | debarshri wrote:
         | or kubernetes or cloud-native
        
           | wongarsu wrote:
           | but is it web-scale?
        
         | ForHackernews wrote:
         | http://thedjbway.b0llix.net/license_free.html
        
       | debarshri wrote:
       | Building a platform to deploy stateless services are the easy
       | part. This might even work nicely at a smaller scale. It is gets
       | super complicated when you want to mount volumes, re-use those
       | volumes. This is like a nice weekend project, contrarian in
       | nature, but it is just not a replacement for kubernetes. This is
       | some bash script orchestration on top of podman.
       | 
       | Bulk of complexity in opensource distro of kubernetes comes from
       | the fact that everything is interface driven and has to work in
       | an generic way. For example, you don't really have to implement
       | cri-o like thing if you are opinionated platform and only
       | supports docker. Similarly, you don't have to build CSI, if you
       | only support ceph or aws' storage. I love the contrarian thought,
       | but matter of the fact is modern orchestration platforms that
       | want to be a general purpose platform is going to be big.
       | 
       | It is a really nice exercise however build something like this
       | when you want to learn about networking, containers,
       | orchestration, storage etc. and how to tied everything together.
        
         | thomasbacklund wrote:
         | Simplenetes does support state, no sweat. But it can't pull a
         | disk out of the cloud for you, there is some traditional Ops
         | involved.
        
           | debarshri wrote:
           | So, it can reschedule container if there is a continuous
           | error state on a particular host it is deployed?
        
             | thomasbacklund wrote:
             | No, don't build the next Netflix on Simplenetes.
             | 
             | However, if you are just dealing with a three node cluster
             | (Yes I know many of you are running tri-cycles with k8s
             | stickers on it) then maybe it can be fine for many
             | applications to not have a scheduler.
             | 
             | Simplenetes does however support multiple replicas of pods
             | so if one node fails it can be OK.
        
               | [deleted]
        
               | debarshri wrote:
               | Simplenetes does not support volumes. Simplenetes does
               | not support rescheduling containers.
               | 
               | Why do I need 17k lines shellscript to run my tri-cycles?
               | I would rather recommend using docker swarm or just
               | podman itself.
               | 
               | you are adding more complexity without to a very simple
               | problem.
        
               | thomasbacklund wrote:
               | If you want something simpler and use podman you can try
               | `podc` [1] which compiles a pod yaml spec into a single
               | executable shell script with a nice managagement CLI api
               | to it.
               | 
               | [1] https://github.com/simplenetes-io/podc
        
       | marvinblum wrote:
       | If you're looking for a simple Kubernetes alternative, take a
       | look at the HasiCorp stack. I use that in production and it's
       | easy to set up and maintain.
        
         | skynet-9000 wrote:
         | Or k3s (https://k3s.io), which is Rancher's awesome and
         | lightweight Kubernetes distribution.
        
           | debarshri wrote:
           | or microk8s with comes pre-installed with ubuntu
        
         | xrd wrote:
         | Do you have a link to an introduction?
        
           | marvinblum wrote:
           | The YouTube channel [0] has plenty of introduction videos,
           | but I find the documentation [1] to be the best place to
           | start. You should set up Consul (service mesh) first,
           | followed by Nomad (orchestration), and Vault (secret
           | management) if you need it. The only thing I initially
           | struggled with was the systemd-resolved config on Ubuntu, to
           | make the service discovery work. I plan to write an article
           | about it, should I ever find the time for it :)
           | 
           | Btw. the cluster consists out of three servers on Hetzner [2]
           | and runs our web analytics platform Pirsch [3].
           | 
           | [0] https://www.youtube.com/channel/UC-AdvAxaagE9W2f0webyNUQ
           | 
           | [1] https://learn.hashicorp.com/consul (for Consul, the pages
           | for Nomad and Vault are similar)
           | 
           | [2] https://www.hetzner.com/cloud
           | 
           | [3] https://pirsch.io/
        
       | danpalmer wrote:
       | This is ~17k lines of shell scripting and claims to be "simple".
       | Kuberentes is probably ~1m lines of Go. I'm not entirely
       | convinced that this is less complex (simpler) than Kubernetes.
       | 
       | There are many factors in complexity, but a big one for me is
       | what I have to hold in my head - global state. From any given
       | point, what do I need to understand to know what's actually going
       | on.
       | 
       | For Go, this is actually comparatively little. Between a fairly
       | straightforward language, static binaries, and the focus on ease
       | of distribution, there's not a whole lot outside of a codebase
       | itself to think about.
       | 
       | However for a shell like Bash there's a relatively large amount
       | to consider. You're very exposed to the underlying OS, to
       | libraries and system packages, to various tools, to
       | configurations users may have specified, to things being
       | redefined underneath you. There's a lot of global state to
       | consider for a Bash script.
       | 
       | I suspect it is simpler than Kubernetes, but I don't think it's a
       | clear cut case.
        
         | intricatedetail wrote:
         | Go has a lot of boilerplate code - simple things take many
         | lines, so I wouldn't be too serious about 1M
        
           | danpalmer wrote:
           | Yeah that's kinda my point. Boilerplate isn't necessarily
           | "complex" in that way. If you can ignore it that's great.
           | 
           | I'm not sure you can with shell scripting because of all the
           | global system state.
        
         | undefined1 wrote:
         | the 30 million line problem;
         | 
         | https://caseymuratori.com/blog_0031
        
         | debarshri wrote:
         | If we take out the argument of OS dependent setup, supporting
         | only stateless services etc.
         | 
         | One of the key benefits of kubernetes are API server and custom
         | resource definitions. If you don't like how kubernetes does
         | stuff. You can change the default behavior and orchestrate the
         | way you want.
        
         | jozvolskyef wrote:
         | To be fair Kubernetes itself probably has 17k lines of bash,
         | and it is a good thing. It is the first go-to project that I
         | use as a reference for bash scripting best practices.
         | 
         | edit: wc reports 47023 lines in *.sh[1], out of which 23836 are
         | unique[2].
         | 
         | [1]: find . -name '*.sh' | xargs cat | wc -l
         | 
         | [2]: find . -name '*.sh' | xargs cat | sort | uniq | wc -l
        
           | oddlama wrote:
           | You might enjoy having a look at
           | https://github.com/AlDanial/cloc
           | 
           | It can distinguish between actual lines of code, comments and
           | empty lines for a lot of different languages.
        
       | gigatexal wrote:
       | 17k lines of shell? Hah give me the infinity lines of Go that is
       | kubernetes -- maintaining shell scripts is a nightmare. At least
       | Go is a proper language with an ecosystem and tests and
       | established best practices, etc., etc.
       | 
       | Also namespaces are a killer feature of K8s imo
        
       | jeffrom wrote:
       | Reminds me of a coworker many years ago who wrote a script he
       | called bash-reduce. Turned out not to be so simple in practice ;)
        
       | llarsson wrote:
       | No Persistent Volume support, so not great for stateful
       | applications. Claims that type of thing is "magic", and therefore
       | out of scope.
       | 
       | Quite an engineering feat, though, I am sure! Is this to have
       | fun, to learn, to actually use in production?
        
         | thomasbacklund wrote:
         | Thanks!! We do use it in production, it is however fresh from
         | the keyb so giving it some time before putting sensitive stuff
         | in there. About the state, it's perfectly doable, but requires
         | some more Ops than k8s and isn't as flexible, naturally.
        
       | theamk wrote:
       | > simple
       | 
       | > 17k lines of shell script
       | 
       | those two phrases don't belong together... to think about this,
       | "17k lines" and "shell script" should not be used together
       | either.
       | 
       | Also, you are a bit light on tests.. there only seems to be a
       | single trivial one, which seems way too low for a codebase this
       | size.
        
         | thomasbacklund wrote:
         | This is why Simplenetes is built with Space.sh [1], a tool to
         | build shell script applications.
         | 
         | About the tests, can't disagree with you, they will come.
         | 
         | [1] https://github.com/space-sh/space
        
           | pcthrowaway wrote:
           | First time I'm hearing of space also. It looks quite
           | impressive, surprised to see no stars
        
             | debarshri wrote:
             | You are hearing of space.sh for the first because it is
             | written by the same authors who wrote this project.
        
             | thomasbacklund wrote:
             | Thanks!
             | 
             | We just moved Space.sh from GitLab to GitHub (hurts in my
             | heart, but yeah community is on GitHub).
             | 
             | Also we are lousy at promoting our stuff, maybe April 1st
             | is not the best day to do this either...
        
               | pcthrowaway wrote:
               | It's OK, I'm sure more stars will start appearing in
               | Space as visibility improves :)
        
               | robertlagrant wrote:
               | > community is on GitHub
               | 
               | I'm surprised when people say this. I thought communities
               | were only around repos.
        
               | conradludgate wrote:
               | It's easier to get contributors and responses when most
               | people already have github accounts. When not many habe
               | have gitlab, it adds some friction to contributing and a
               | lot won't bother
        
         | a-dub wrote:
         | i dunno. autotools is hairy, but it also solved some incredibly
         | hairy problems over an enormous breadth for a very long time in
         | a very reliable manner.
         | 
         | portability across all the different unices with their weird c
         | compilers and differing libcs that actually worked out of the
         | box every time was a gargantuan task.
        
         | [deleted]
        
         | scubbo wrote:
         | > those two phrases don't belong together
         | 
         | I assumed it was tongue-in-cheek?
        
       | amerine wrote:
       | This is my kind of tom foolery. Love it. You should come work
       | with me at Heroku: https://www.heroku.com/careers/software-
       | engineer-heroku-runt...
        
         | thomasbacklund wrote:
         | Thanks for sharing, I'll have a peek :) Heroku is ACE
        
       | jfoutz wrote:
       | -q Set to be quite.
       | 
       | I doubt it's intentional, but I kinda love it.
        
         | thomasbacklund wrote:
         | Oh geez.. Hehe, thank you for pointing that out _facepalm_
        
       | verdverm wrote:
       | What happens if a node fails?
        
         | thomasbacklund wrote:
         | As long as you have multiple replicas of the pods they keep
         | serving traffic.
        
           | verdverm wrote:
           | So no work rescheduling? That is a significant divergence
           | from k8s and means you cannot "replace" it with this
        
       | mikece wrote:
       | 1. Anything that offers effective competition to Kubernetes is a
       | Good Thing. I'm not saying this is because I haven't look at it
       | closely enough but competition brings about improvement.
       | 
       | 2. Why do people write "Simplenetes has a 100x less code than
       | Kubernetes" instead of saying it has 1/100th the code?
        
         | HereBeBeasties wrote:
         | But you don't understand. 100x less code than k8s means that
         | using it must reduce my own codebase by 99 million lines of
         | code! Who wouldn't want that?
        
         | verdverm wrote:
         | why is that a perceived benefit
         | 
         | By contrast, Kubernetes has at least 1000x more developers
         | working on it
        
           | oropolo wrote:
           | Don't you mean "1/1000th less" developers working on it?
        
       | kjjjjjjjjjjjjjj wrote:
       | This is a cool idea regardless of being simple or complex. Who
       | cares, its cool.
       | 
       | Nice job
        
         | thomasbacklund wrote:
         | Thank you :)
        
       | sova wrote:
       | Languages: Shell 100.0%
       | 
       | Impressive
        
       | knodi wrote:
       | If you drop enough feature everything is simpler.
        
       | a-dub wrote:
       | 17k lines is a lot of shell... but... it bypasses all the
       | complexity of heavyweight scripting languages, bash is a
       | lightweight interpreter that is always there and just works and i
       | bet it's fast.
       | 
       | this is a cool idea.
       | 
       | next up, somebody will modernize daemontools for the
       | container/cluster era...
        
         | a-dub wrote:
         | i must say though, i'm not sure how i feel about a shell script
         | "daemon"...
        
       ___________________________________________________________________
       (page generated 2021-04-01 23:02 UTC)