Using Kubernetes to rethink your system architecture and ease technical debt
stackoverflow.blog
stackoverflow.blog
The writer starts by saying that servers were treated as pets, which inherently means difficulty (as the author clears out). I assume that, at some point, their services got reworked to a shape where they could be deployed in servers treated as cattle. This is a work the author had to pay no matter if the final goal was Kubernetes, Autoscale Groups or any other solution.
Then the author explains how they got to the conclusion that they need to containerise their service(s) in order to be able to use K8s, which would then, in turn, allow them to scale properly (adding on top the Go rewrite that is mentioned at some point in the post). The author also explains that Autoscale Groups were discarded because of their complexity.
It's not clear to me that K8s was the actual thing that helped them scale, but rather the work they put into reworking their services. In my experience, once your service(s) are ready to be deployed in servers that can be managed as cattle, the benefits show up independently of the deployment solution that is used to deploy the service(s) (K8s, Autoscale Groups, etc...).
Just to add on my point, wouldn't the result (in terms of performance / resources usage) be the same if instead of "containers" the author had chosen "AMIs" and instead of "Kubernetes" the author had opted for "Autoscale Groups"?
If that were the case (which I believe it might have), the other thing to consider would be the difficulty of managing a K8s cluster vs the difficulty of managing an Autoscale Group. I've seen quite some horror stories about K8s[1] and I'd rather choose ASG over K8s.
[1]: https://k8s.af
"I need X million USD in engineering spend this year because we need to be on Kubernetes".
"I need X million USD in engineering spend this year to fix half a decade of awful technical execution and decision making (that all happened under your watch, BTW)".
Leave that out. Many right decisions look stupid later. It will happen to you to. Time makes fools of us all.
"I need X million USD in engineering spend this year because we need to practice DevOps and SRE."
Also, it's silly to just assume that continuing to treat pampered EC2 instances that had to be manually deployed ande cared for is something that benefits a projectsl, specially if the company already shed those bad practices elsewhere.
‘I need X million in USD in engineering spend this year so I can add “I managed a large SRE/DevOps team” on my resume.’
I don't know what is there in the IT/dev industry that compels some characters to quickly whip out blanket accusations of gross incompetence to anyone who isn't them.
This mindset is particularly egregious given that the whole industry has enthusiastically adopted as a best practice just agilying big balls of mud through sequences of quickly delivered stopgap solutions while refactoring and paying off technical debt is seen as wasted effort.
The author of this blog post clearly described refactoring a legacy system that worked reliably in hopes to improve their operations. Yet, here you are accusing someone investing their time and effort to improve their stuff as something that could only be explained as incompetence?
It was a satirical observation (based on my experience) that "the business" tends to scoff at unsexy foundational rework of existing tech. The trendiness of Kubernetes is used effectively to "trojan horse" that kind of work in.
I am jokingly suggesting that at this stage maybe that's the real value of Kubernetes.
Its nice to love your tools. Don't start thinking they are the one true path.
Behavioral patterns for a user are not tethered to one ephemeral implementation.
I ran a huge VMWare cluster in 3 data centers across the globe, not so different from an AWS/EKS pipeline.
Yes, I had to treat the hardware like pets to an extent. But the developers had no problem pivoting between VMWare and what we ran in AWS because the software tooling we provided looked the same.
Some folks believe memorizing YouTube videos = expertise.
You can always point out that pods are ran on nodes. Nodes use the standard built in GCP Auto-scaler (instance groups + load balancer). So its a great wrapper! But, it's a wrapper. GCP also! has a way to use a docker image as your VM.
This individual was shocked to learn I thought you could treat the iron-born servers as cattle too. (But, my first clusters were in the late 90s, so got to the cattle concept quite some time ago)
I don't see the point of your counterargument. For starters, there are plenty of managed containerized solutions that just run your containers without you ever having to bother with them. Secondly, it seems you got it entirely wrong: the point of pets vs cattle are the services, not the servers. You want to take your services down and put them up without surprises. Unless you're planning on rebooting your infrastructure just for shits and giggles, it makes no sense to talk about treating "servers" as pets, specially as you already get those as managed services just like you get VMs.
It seems you're missing the forest for the trees. They put in the work to refactorize their services so that they could be treated as cattle and also autoscale, and the author stated that after doing his homework he determined that for his company Kubernetes offered the most benefits. There isn't much to read from this.
> Just to add on my point, wouldn't the result (in terms of performance / resources usage) be the same if instead of "containers" the author had chosen "AMIs" and instead of "Kubernetes" the author had opted for "Autoscale Groups"?
The author explains that he considered using EC2 instances but after analising the tradeoffs the company decided to just jump to EKS.
If you'd like to debate containers vs VMs then it's perfectly fine, but the author of this blog post just documented his learning path and pointed out what worked for him. Sometimes you need to call a shot, and the tradeoffs you need to consider are so minor and irrelevant that a coin flip will do.
I thought they were running their own farm with most of the action on IIS with ASP.net and MSSQL, and some elasticsearch for search.
[1] https://nickcraver.com/blog/2016/02/17/stack-overflow-the-ar...
I also thought it would be about StackOverflow until they started mentioning all the Pusher related products.
I strongly disagree. What feels easy for one developer may be super hard for others.
For me, the Kubernetes tutorial [1] and documentation [2] [3] feels borderline incomprehensible. It introduces several abstract concepts at once without telling me what they really mean. It raises more questions than it answers.
For example:
> Kubernetes coordinates a highly available cluster of computers that are connected to work as a single unit.
What does that even mean? Is that “single unit” the entire application? Or rather one component, e. g. the backend? You usually don’t have more than one service per container, right? So what exactly is the cluster here? Why is there not a single example?
> The Control Plane is responsible for managing the cluster. The Control Plane coordinates all activities in your cluster, such as scheduling applications, maintaining applications' desired state, scaling applications, and rolling out new updates.
We haven’t even established what the cluster is and how it relates to an application but now we’re already talking about several applications? I feel entirely lost.
Ok, let’s look at another introductory page [2].
It says things like:
> The worker node(s) host the Pods that are the components of the application workload.
But it won’t tell me what a Pod is. So I click on the Pods link [3].
It says:
> A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers. A Pod's contents are always co-located and co-scheduled, and run in a shared context. A Pod models an application-specific "logical host": it contains one or more application containers which are relatively tightly coupled. In non-cloud contexts, applications executed on the same physical or virtual machine are analogous to cloud applications executed on the same logical host.
I find that explanation outright hostile. Not a single example that a newbie can understand. Instead, a pile-up of more and more abstract concepts. I still have no clue how a Pod, a node, an application, its instances, its components and a cluster relates. I’m giving up here.
This documentation is abysmal. How can the blog author possibly call this thing well-documented?
[1]: https://kubernetes.io/docs/tutorials/kubernetes-basics/creat...
[2]: https://kubernetes.io/docs/concepts/overview/components/
K8S (imo) isn’t for noobs. A car factory isn’t for noobs. Ideally you would want to understand how a car is made and works, how to run an assembly line, and how to build a factory communication systems before building and running the car factory. Similarly, you should understand how docker containers works, how to run infrastructure, and how to configure system networks and dns before building and running a K8S platform.
The analogy may not be perfect… K8S is complicated but not impossibly so. Practice, working with something like Rancher, and classes will go along way to help understand it.
So which set of containers would be a pod here? And which would be the nodes? And what would be the cluster?
(For the sake of the example, let’s assume that both A and B scale independently.)
Now if you configure it right, those two pods are two deployments. You can scale those up and have a load balancer sitting in front of them. That load balancer will expose app and send in traffic to the stateless containers in the cluster.
If you couple them like you’re suggesting then you’re wasting resources by scaling out your FE serving infrastructure needlessly.
And at some point you’ll possibly end up splitting your backend into multiple services. Would you couple a frontend container to each of those?
But if I'm coupling them in the same pod then am I really wasting resources? Aren't pods the equivalent of 'hosts' in the Kubernetes world, i.e. aren't resources allocated at the pod level? And as you said,
> serving a static file (assuming you didn’t do it via a CDN for some reason) uses a lot less resources than serving a backend request.
If I'm serving static files from the same pod as my backend, the pod shouldn't really need any more resources than if it was just serving the BE, right?
> And at some point you’ll possibly end up splitting your backend into multiple services. Would you couple a frontend container to each of those?
The most likely scenario in that case would be having a backend-for-frontend pattern, so the FE and its BFF would still go in the same pod, and the other services would probably go in different pods.
You can shove the backend and the frontend into the same container, but it’s needless.
> The most likely scenario in that case would be having a backend-for-frontend pattern, so the FE and its BFF would still go in the same pod, and the other services would probably go in different pods.
They are still two different concerns and don’t need to both be served from the same pod (the BFF pattern doesn’t even remotely require this).
You of course can do whatever you want, but shoving different things together (even if coupled via an API) is an anti pattern.
In general, the "one container per pod, usually" rule works pretty well. Adding more pods does create additional cognitive complexity, but by the time you need k8s, you really should have someone, or a team of someones, responsible for dealing with that -- I find that too often folks reach for Kubernetes when they could use a simpler container strategy (RIP, somewhat, Docker Swarm).
Generally I don’t see them and where they might be useful, I end up using a K8S Cronjob instead.
But why? I want each pod to have its own liveness probe and be able to scale independently.
K8S is absolutely not a sustainable thing with its learning curve, and it is destined to be abstracted by a "dumb" layer, sort of like Git has two APIs - for developers and for the users. In fact, I believe that is already happening.
Few companies can afford a team of devs doing care and feeding for this thing full time.
Which is always.
> Some people, when confronted with a problem, think "I know, I'll use Kubernetes." Now they have two problems.
Kubernetes can be a great solution to a set of problems, but it is not automatically that way. My company is in the midst of adding k8s support to a large legacy application and that work has turned into a deep dive into madness in some places. To be fair, we're making it hard on ourselves by supporting both k8s and the legacy environment, but the point stands.
And Helm doesn't help.
Unless you need so many of the features, mostly k8s seems to be a way to increase complexity and build resumes. Yes, you need to automate building instances and service discovery, but neither of those tasks needs millions of lines of code.
So I build my own out of assembly. Now my REST api is free of technical debt!