Wednesday, August 17, 2022
How-tos

Do You Really Need Kubernetes (K8s)?


Illustration showing the Docker and Kubernetes logos

Kubernetes has a reputation for being complicated. While it’s a fantastic piece of software, sometimes the benefits may not outweigh the added complexity, especially for small businesses managing simple deployments. Is plain old Docker good enough?

What Kubernetes Is Great At

Kubernetes (K8s) is used with Docker very often in professional environments, and this can make it seem like it’s an upgraded or more organized version of Docker. While this is true in some regards, it’s not the exact purpose of K8s.

Kubernetes is a “container orchestration system,” and it’s important to remember what that means. The Kubernetes Control Plane handles all the details of “orchestrating” which containers will run on which nodes. It separates the hardware from the software and lets your machines just run as worker nodes, which is ideally all they really should be.

Kubernetes fantastic when you have a large, production deployment that needs to be able to scale, repair, and manage itself automatically. When you’re managing hundreds of containers across many servers, having to deal with load balancing and moving containers from server to server can get annoying. K8s handles this for you with extra configuration options.

Graphic showing Kubernetes cluster architecture
Graphic showing Kubernetes cluster architecture

Kubernetes is also similar to infrastructure as code (IaC), another useful concept. It lets you control your services using configuration files that can be tracked through Git. This can drastically improve your deployment processes by allowing it to be tracked along branches, tested, versioned, and rolled back if needed.

What Kubernetes Isn’t Great At

The main downside of Kubernetes is that it’s notoriously complicated. This might not be a huge problem if you’re already familiar with it, but in any case, it adds extra time and complexity to getting your applications up and running. It’s a great tool to learn, and a good skill to have. But it works better with larger deployments, and if you’re running only a few servers or a few containers, the extra effort of Kubernetes might not be worth it.

Kubernetes is a middleman, but you can always go old-school and take the role of orchestrator yourself. The nice thing about Docker is that it makes the process of creating and moving applications around easy with containerization. Creating a new server is relatively simple, and you could have a new EC2 instance from AWS running your container in a manner of minutes.

Without Kubernetes, the only added problem you have is needing to run commands manually on your servers with the docker CLI or docker-compose API. If you need to add a new container, or move a container to another node, you’ll need to run those commands again. This can be an issue if, for example, you experienced unexpectedly high traffic and needed to launch more instances automatically. K8s would solve that problem. But in many cases, your traffic may be relatively steady, or at least predicable on a week-to-week basis, especially for backend services that don’t really need to auto-scale.

Essentially, Docker itself already improves the process of running portable applications by a large amount. It’s a huge improvement over having to install applications the old way. Kubernetes improves upon Docker a bit, and automates some tasks needed for big networks, but adds a lot of complexity.

The value of it will depend on how much time it actually saves you. If this complexity is acceptable to you and ends up saving you time, you should use K8s, but if it doesn’t, you shouldn’t waste your time with it—especially when you can always simply swap to it later on if need be.

What Should You Use Instead?

It’s good to take a step back and look at what you’re really considering Kubernetes for. If you want your network to auto-scale, manage your resources automatically, and launch pods on different servers based on configuration, Kubernetes is a great tool to learn. If you’re concerned about the complexity, cloud providers like AWS do have managed Kubernetes services like EKS, which can handle some of the dirty work for you, especially when it comes to management and provisioning resources.

However, if all you want is a way to manage your containers more easily, or auto-update containers, there are far simpler tools out there for the job. They might not be as fully featured as Kubernetes, but they’ll be simpler and can save you time.

If you want to auto-scale certain services, you’ll almost always need to be talking to a cloud provider’s API to provision new resources. Kubernetes can handle this for you for many platforms, but services like AWS, Azure, and GCP all have simple container services with auto-scaling features. AWS’s ECS service can easily be set up to auto-scale to meet high demand.

RELATED: How to Get Started with Auto-Scaling Container Deployments on AWS ECS

If you need to auto-update containers whenever you push new versions to your Docker registry, you can use a service like Watchtower. It runs on a worker node as a Docker service itself, with the Docker socket exposed, and watches for changes. Once a new container is pushed, Watchtower will restart the container. This will save you time running restarts of containers, and is a good alternative to Kubernetes updates.

docker run --detach 
--name watchtower 
--volume /var/run/docker.sock:/var/run/docker.sock 
containrrr/watchtower

If you want to be more organized in general with how you manage your containers, you should consider setting up a Docker management GUI like Portainer. Portainer is a web-based GUI for managing Docker deployments. It works with multiple worker nodes, much like Kubernetes, but it lets you handle the job of orchestration, setting up containers on the servers you want.

Portainer is really easy to set up since it’s packaged as a container itself. If you’d like to learn more, you can read our guide to setting it up and working with it.

RELATED: How to Get Started With Portainer, a Web UI for Docker





READ SOURCE

Leave a Reply

This website uses cookies. By continuing to use this site, you accept our use of cookies.