Containers Dev Ops Docker Kubernetes

Kubernetes vs Docker

Kubernetes and Docker are on the rise. Both the technologies have had very different roots but have become intertwined in the recent years in ways no one expected them to. The communities have come together, packages are ported among all possible operating systems and being largely open source they gave rise to a plethora of satellite projects and competitors.

All of this can be overwhelming to any new user trying to make sense of this relatively new paradigm. Let’s discuss the major differences between Kubernetes and Docker by first taking a deeper dive into what the technologies really mean. If you have some familiarity with, Docker or K8 (short for Kubernetes) then you can skip ahead and read the TL;DR section.

What is Docker?

Docker is a containerization technology. You can run multiple applications all isolated from one another on the same operating system without any need of virtualization but all the benefits of a virtualized environment. Think of Docker containers as really light-weight VMs for Linux (also Windows, but that’s not as popular).

Docker has 3 main components, first the Docker engine which runs in the background and manages running containers and their provisioning. It exposes a REST API which the Docker client consumes and this enables users to interact with Docker and craft new containers, or manage the running ones.

Docker, however, is a single system application. Meaning, it runs and manages containers on whatever system it happens to be running on.  Huge applications with tonne of traffic and millions of requests hitting them from around the globe need more than one server. That’s where Kubernetes comes in.

What is Kubernetes?

Kubernetes takes advantage of containerization technologies, like Docker, to run multiple replicas of your application across servers and data centers all over the globe.

One of the containerization technologies that Kubernetes make use of is Docker. Kubernetes consists of a whole array of different softwares for managing your cluster. It provides a management agent kubeadm, which runs on a few selected master nodes (nodes are VPS or physical servers) and then there are worker nodes with Docker installed on them with a kubectl which talks to the Docker engine to automate the process of spinning containers up or taking them down. The kubectl agents running on all worker nodes take orders from the master node and give them feedback about the state of the application running on their node. This is roughly how a K8 installation typically works.

You can also aggregate different related Docker containers into packages (called pods). For example, you can put together SQL database and Redis cache containers together in a pod, since you want database and its cache to coexist.

Similarly, you can expose pods to the other pods as services (also known as microservices) so you can have 50 SQL/Redis pods exposed as the datastore service to the front-end of your application and so on. The advantage you get is that the 50 pods could run across several data centers and even if a few of them go down, others will pick up the slack.

Kubernetes is much more than a technology. It is a way of reasoning about running your software across a distributed system.

Kubernetes without Docker

As you can tell from the  above that K8 relies heavily on containers. Docker is but one of many containerization technologies that are out there. Other include rkt by CoreOS, LXC by Canonical, Jails on FreeBSD and Zones in Illumos and SmartOS. Kubernetes could potentially be implemented on top of anyone of these technologies. In fact, it works quite well with rkt by CoreOS.

However, due to Docker’s popularity, community and organizations have gone above and beyond in ensuring that Docker offers anything and everything that Kubernetes’ specifications ask it to. It is because of this reason that even projects like Docker on macOS and PC are Kubernetes certified.

Docker without Kubernetes

The way Kubernetes has one of the finest support while using Docker, Docker itself relies heavily on Kubernetes to deploy containers at a large scale. Docker does have its own container management and orchestration system known as Docker Swarm, which is supposed to be a Kubernetes alternative.

Despite Docker Swarm being a native technology on Docker, Kubernetes is what people are asking for and the current market projections seem to indicate that K8 is going to win the largest market share. Docker owes its success largely due to its symbiosis with Kubernetes.

TL;DR

To cut a long story short, Docker is a containerization technology meant to run on a single computer. Kubernetes is a management technology which manages large number of containers across numerous compute nodes.

Docker happens to be one of the most well-suited technology out there to build your K8 stack with. You start by making sure your application run as a docker container, then K8 ensures that this container can scale across the entire globe, if the need to do that arises in the future.

About the author

Ranvir Singh

Ranvir Singh

I am a tech and science writer with quite a diverse range of interests. A strong believer of the Unix philosophy. Few of the things I am passionate about include system administration, computer hardware and physics.