Random Ramblings

Kubernetes vs Containers

March 14, 2020 | 5 Minute Read

kubernetes   containers   docker   cloud

If you interact with Software development teams as a part of your role, you would have heard the term Kubernetes (or 'K8s' as it is fondly known). This is a complicated concept to understand, especially if you do not have a Software Engineering background.

Last week, I was in a meeting with a few non-technical colleagues who were sharing customer stories around containers and Kubernetes. They were using jargon like containers, docker, kubernetes in this conversation.

A curious colleague who was listening in turned to me and asked “What is the difference between a Container and Kubernetes?” There was silence in the room, everyone eagerly waiting to hear this technical person’s answer.

The easy answer  —  Docker is used to create containers and Kubernetes is used to orchestrate them. I could get away with this explanation, but that is just throwing more tech jargon to the fire. How can you clearly articulate  the differences between these technologies, let alone explain these concepts in a human-friendly, digestible way?

Background

Let’s say, we are building a simple website called chatter.com where people can post short updates about their life.

Here the engineers build this application in a programming language like java. They get it working on their machine, but you cannot see what they have built until this software application is available on the internet. Hence, this software needs to be deployed somewhere.

This application can be deployed on the company’s cloud infrastructure — it’s just computers on someone else’s hardware.

Since the application is written in java, the computer needs java to run the website. The engineers therefore package this application with java, so that it can be run on any computer just like it runs on the engineer’s machine. 

This package is called a container. Just like regular airtight food containers, containers in the digital world come in different shapes and sizes. Based on the size of containers, more than one container can run on a computer. 

We have our chatter.com running with containers. So what’s the deal with Kubernetes?

Containers to Kubernetes

For the next part, let’s pretend that the Cloud Infrastructure is like a 2x2 storage unit, where each shelf is a computer. Containers are just boxes. There are already a few (black coloured) containers on these shelves.

Each cube is a computer. Pink box is the chatter container

Engineers write scripts to drop the chatter container on an available shelf in the storage unit. This container is running on the top-right shelf (the pink container in the image).

Now, imagine there is an earthquake and this container suddenly crashes to the floor. Yep, sometimes websites crash too! Someone has to repeat the previous step again to replace the container.

How great would it be if there was someone watching over all these containers, making sure they are always running well? Enter Kubernetes to the rescue.

Kubernetes healing a burning pod

When a container crashes, k8s tries to heal the container and brings it back to life. It makes sure all containers are healthy and safe. K8s helps with finding a vacant spot for containers and allocates them to the appropriate shelf based on its size; ensuring the optimal use of shelf space.

This is a very high level differentiation between containers and k8s. There is more to k8s than allocating compute to containers. If you are interested in learning more, please leave a comment. I will share more details in subsequent posts. :)