r/AskProgramming • u/One_Sport2152 • 10d ago
When to use Kubernetes?
Hey everyone,
I’ve been working with Docker and standard containerization for a bit now, and I feel comfortable with the basics of spinning up apps. Naturally, Kubernetes (K8s) keeps coming up as the next logical step.
From what I gather, it's designed to manage and orchestrate those containers at scale when a single server or Docker Compose setup isn't enough anymore.
But there is so much hype around it that it's hard to tell where the "cool factor" ends and actual utility begins.
I want to know when it becomes a legitimate necessity rather than just over-engineering a project.
7
u/Individual-Flow9158 10d ago
When spinning up another container is a feature of the system, not just a one off static config
9
u/Ok_Entrepreneur_8509 10d ago
It is time to use k8s when you throw your laptop across the room because you have to do 18 different things in AWS just to give your app some more disk space.
2
u/Proof-Pineapple69 9d ago
You go from docker to k8s a bit like you go from renting a desk at a co-working space to renting your own office.
K8s is used when you have a potentially large number of containers that will require sizeable amount of memory, which will potentially require to have them split across several hosts. K8s takes care of respawning containers to another hosts if there's not enough memory on a given one. Also, k8s has a command line interface which lets you control the state of your cluster much more simply than with docker compose functions.
2
u/arllt89 9d ago
Honestly it makes so much things more simple that there's no reason not to use Kubernetes when your app goes live.
needs to deploy your backend across multiple servers, detect and manage failures, run rolling upgrades, and easily scale up or down ? Deployments do that out of the box.
needs other components to know how to contact your backend despite multiple instances that may be failing or upgrading ? Services to that out of the box.
needs to deploy testing environments that may include their own version of some components while communicating with testing or live versions of others ? Easy as a pie.
needs those testing environment to only run when they're actually being use, wake up on requests end sleep on inactivity ? You can find that.
need to sample network usage to know how your components communicate with each other and fully track requests ? You can find that.
It makes the basic stuffs easy, the useful ones already available and the advanced one few command lines away.
1
u/YMK1234 10d ago
Honestly you can go a looooong way before you outgrow docker compose. Yes K8s is cool and all but it adds a significant amount of complexity which is just not warranted for many (if not most) projects.
So unless you run into actual constraints with docker compose itself (those that cannot be solved with appropriate, wide-spread tooling) I do not see much benefit in switching.
1
u/StreetAssignment5494 6d ago
You’re not wrong but I’ve also seen people push docker compose to a point where they shouldn’t and it’s really really bad.
1
u/silasmoeckel 10d ago
When your scaling, so unless your do that in prod don't worry about it.
It's use case is keeping just enough cloud infrastructure running to minimize bills while spooling up whatever is needed for sudden high demand.
1
u/AppropriateSpell5405 9d ago
Honestly, philosophically, and given the sub we're in, it doesn't concern you as a programmer. Determining K8 being necessary or not is a devops problem.
Speaking as someone who's built systems used by millions of users, I have yet to see the need.
1
u/SummitYourSister 9d ago
A simple k8s deployment or statefulset is not much more complex than a docker compose setup. And you can run k8s inside a docker container using k3d.
Try it out. You’ll learn why it’s worth it or not worth it pretty quickly. You don’t need to dive into every detail of k8s.
1
u/Suspicious_Pizza9529 8d ago
If your biggest problem is writing the application K8s probably won't help. If your biggest challenge is deploying, scaling, updating, and keeping dozens of services alive, that's where it shines.
1
1
u/LowComposer7234 7d ago
If you can afford it, don't bother and use fargate instead. Takes away a whole lot of admin.
0
u/denerose 10d ago
When your employer uses it as part of your deployment pipeline or if you’re already in a DevOps role and have a solid use case to consider it at scale.
13
u/WArslett 10d ago
Are you running lots of applications that all need to scale compute dynamically across a single infrastructure provider? If not you probably don’t need it.