Kubernetes is an tool that manages all the moving parts behind running running apps in containers like Docker. This makes scaling your application very easy, because your server infrastructure is separated from the code running on it.
What Does Kubernetes Do?
Kubernetes is often mentioned alongside Docker, but they each accomplish different tasks. Docker packages up applications and all of their dependencies into single files, called container images, that can be ran on a server without any manual configuration. The Docker engine is similar to a virtual machine, but is much slimmer and more performant, designed simply for running a single application in an isolated environment.
Kubernetes is an orchestration engine, and provides a platform for running Docker images on. It supports using Docker images, as they’re by far the most popular container format. Containers allow your code to be distributed very easily without worrying about whether the server is configured to run the code properly.
A master Kubernetes server will manage a cluster of worker nodes. These worker nodes can run any number of containers, which are packaged in Kubernetes Pods. The master server handles the deployment of Pods onto worker nodes, and tries to maintain a set configuration. If your application meets more traffic, Kubernetes can provision more resources, and if one of your servers runs into issues, Kubernetes can move the Pods on that server over to the rest of the network while you fix the issue.
But while Kubernetes provides a lot of features of a Platform as a Service (PaaS) system, it doesn’t actually provision any hardware. Kubernetes is pure software, and is open source. PaaS systems like AWS EKS build on top of Kubernetes, and in many cases offer it the ability to provision more resources for itself (auto-scaling).
Why Use Kubernetes?
Kubernetes brings with it all the benefits of Docker, and containerization in general. Containers help keep your code organized and managed, with all the dependencies in one place. Your code will run the same in a development and testing environment as it does in production, no surprises.
The Docker images being run on the Kubernetes platform are separate from the platform itself, and have no idea that they’re being run in Kubernetes pods. This decoupling of applications from infrastructure makes Kubernetes extremely powerful as a replacement for your existing deployment cycle. You won’t have to worry about whether your code will run properly on your servers.
A quick development cycle puts more pressure on your Ops team to worry about actually running your code. If you’re having issues managing the installation and configuration of your app across your servers every time your code needs updating, Kubernetes can make that much faster.
And if you really just don’t like configuring and managing servers, a managed Kubernetes service like AWS EKS can alleviate that issue, and take your app “serverless.”
How Do I Get Started?
Kubernetes is service agnostic, so you can set it up yourself on your own servers if you’d like. However, Kubernetes is pretty complicated, so there are many turnkey solutions from the major cloud providers that use their resources to power your worker nodes. They will all be Kubernetes compliant, so you’ll be able to switch between them with minimal issues.
If you’d like to set it up yourself, you can do so with the
kubeadm toolbox. You’ll need a master machine to run
kubeadm on, which will control one or more worker machines running
kubelet. The master machine manages deployment of the container to the worker machines. You can read their getting started guide in the Kubernetes docs for more information, but be prepared for a night of configuring.
AWS EKS is Amazon’s solution, which can run Kubernetes apps across multiple AWS availability zones. EKS doesn’t require much configuration at all; all you have to do is provision new nodes. You pay $0.20 per hour ($150 per month) for each running cluster, as well as paying for the EC2 and EBS resources your worker nodes consume.
If you don’t need a full Kubernetes cluster, but would still like to run containerized apps, you can use AWS’s Elastic Container Service (ECS). ECS runs Docker containers, and has its own scaling system.
Microsoft’s Azure Kubernetes Service (AKS) is a managed Kubernetes service that integrates well with an Azure pipeline, making it easy to go from code in source control to containers deployed across your Kubernetes cluster.
Google is the original creator of Kubernetes, so naturally they offer a managed Kubernetes service through Google Cloud Platform.