Crack the code : A primer on Containers, Dockers and Kubernetes

Welcome to 2024 !!!

As we enter this new year, I wish you all inspirational and prosperous year. This is my first post in 2024, and I hope its as helpful as the other posts throughout last 6 year journey 🙂

You will be with me that everyone is talking about Containers, Dockers and Kubernetes nowadays, but what do they actually mean? Its sounds complex, isn’t. Objective of this post is to enable everyone on these new buzz words irrespective of work profile. It should give you basic understanding of these technologies and enable to hold the conversation. So enough said, lets get to business…

Container Primer

What is container and why do we need it? To understand it lets get back in time when applications were hosted on physical servers. They were bulky, power hungry and mostly hosted individual application. So if you need a new application, IT will procure a new server to host it. The major issue with this model was high Capex and Opex cost (power and cooling etc) and most of the time, servers were underutilized as only one application was hosted on it while servers were planned for peak.

Enters Virtualization…

And then entered VMware with Hypervisor capability. Now a single physical server could host multiple VMs each hosting applications individually. This bought down cost of physical servers as well as maintenance. However, hypervisors also had their limitations. Each VMs needed their individual OS, eating up system resources along with licenses. Also operational activities were still there like updating OS, antivirus and maintaining security policies. Sweaty ):

Welcome Containers

Containers are secured, lightweight software package that sits on top of operating system and can host applications. So unlike hypervisors, now you need one base OS and multiple containers, each hosting applications can sit on top of it. Hence there is no need to manage OS for containers and need minimal system resource. They are super fast and can turn ON and OFF just like your TV. These unique capabilities have got containers in so much demand. Below is illustration of physical, virtual and container environment.

Containers have become a foundational technology for modern cloud-native applications and Microservices so lets understand them next.

Cloud Native Applications and Microservices

Cloud native applications are software programs that consists of small, independent services called Microservices. Traditional, monolithic applications used to have single block structure containing all required functionalities. So lets take example of an ordering application which has different modules as front end, authentication, invoicing, stock etc. If developer need to make any change in stock, entire application is down. Similarly, if admin need to patch any module again whole application will be impacted.

By using cloud native approach, application can be broken in smaller microservices which will make all its modules independent of each other. If you need to fix or update one module, only it will be impacted and other services will continue to work.

Containers can host these microservices along with their dependencies to provide isolation, flexibility and scalability. It really helps as we can deploy them instantly using very few computing resource.

Docker Primer

There are two thing – Docker Inc. with big “D” and docker technology with small “d”. Docker Inc, previously called DotCloud had developed system to manage containers. They realized power of containerization and decided to make underlying technology open for public. This is how docker application came in existence. Its open source and lives on GitHub.

How docker helps

Docker is a platform to build, package, distribute and run applications in containers in a simple way. You can use docker to package your application source code into container or image. Once image is ready you can push it to registry as Docker Hub(I will cover it next) and then start container from it again using docker. That easy 🙂

Docker offers a free and open-source Community Edition (CE) which is free to use and you can contribute too in it. It has quick release cycle. It has another Enterprise Edition(EE) with slower and stable release cycle and official support.

Docker hub – It is a public registry hosting millions of container images for various applications. You can use them and even upload your own image into it.

So this is about docker. But you wont find applications running on one containers in production. So while docker is good to take care of individual container, the key is scale and here comes Kubernetes,

Kubernetes Primer

Kubernetes or in short K8s has its roots in Google internal project “Borg”. Google was using containers to manage searches and even Gmail and Borg was container orchestration system. in 2014, Google open sourced the technology and later in 2015 Cloud Native Computing Foundation(CNCF) became its custodian. Kubernetes has gained one of the most significant traction around technologies, and today all major cloud service providers as GCP, AWS and Microsoft Azure offer Kubernetes Services.

Why Kubernetes is so cool

We learned earlier that docker provides mechanics to create and run containers. But in production we need to scale and deploy complex container architecture and that is where Kubernetes helps. It manages things like how many containers to run, run them on which host, scale up and down as per demand, monitor applications, automatically restart and replace unhealthy containers, load balancing etc. So it does orchestration, resource management, healing and provide simplified management with agility and reliability.

Imagine a busy city with heavy traffic flow. Kubernetes is like the central traffic control system which directs vehicles (containerized apps) across roads (network) efficiently. If there is heavy traffic from one side, it keeps the green light longer (scale up). If there is complete congestion, it redirects (self heal) the traffic. and now as you can understand what all Kubernetes can do, it should give you an idea why it has got so much traction.

So this is all I wanted to cover in this post. I will cover some deep dive in coming blogs so subscribe for notification. Please leave a comment with your questions, if any. So by the time I see you again, ta-ta.

Leave a comment