What is Containerization and Kubernetes? How they relate with each other?

Cloud computing changed the way we design, develop and deploy our applications. There is almost a buzz word a week on cloud technologies and AWS/Azure/Google cloud also competing and in the race with great pace to offer these popular buzz words as services.

In another article, I tried to provide my view of Cloud and some as a services till FaaS and there is one missing piece there, which is nothing but Containers and this blog post is all about containers.

What is a container and how does it got that name?

Container technology, also simply known as just a container, is a method to package an application so it can be run, with its dependencies, isolated from other processes. In other words, a container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.

Container technology gets its name from the shipping industry. Rather than come up with a unique way to ship each product ( software analogy of application), goods get placed into steel shipping containers, which are already designed to be picked up by the crane on the dock, and fit into the ship designed to accommodate the container’s standard size. In short, by standardizing the process, and keeping the items together, the container can be moved as a unit, and it costs less to do it this way. Also each container does not have any coupling with what kind of ship on which it placed and what are its dynamics.

Get what exactly a container in around a minute from video below :

Containers offer a logical packaging mechanism in which applications can be abstracted from the environment in which they actually run. This decoupling allows container-based applications to be deployed easily and consistently, regardless of whether the target environment is a private data center, the public cloud, or even a developer’s personal laptop.

Containerization provides a clean separation of concerns, as developers focus on their application logic and dependencies, while IT operations teams can focus on deployment and management without bothering with application details such as specific software versions and configurations specific to the app i.e. clear separation of duties.

Containers are a form of operating system virtualization. A single container might be used to run anything from a small micro-service or software process to a larger application. Inside a container are all the necessary executables, binary code, libraries, and configuration files. Compared to server or machine virtualization approaches, however, containers do not contain operating system images. This makes them more lightweight and portable, with significantly less overhead.

Just as how software libraries package bits of code together, allowing developers to abstract away logic like user authentication and session management, containers allow your application as a whole to be packaged, abstracting away the operating system, the machine, and even the code itself

What are Benefits of Containers or Containerization?

Containers are a streamlined way to build, test, deploy, and redeploy applications on multiple environments from a developer’s local laptop to an on-premises data center and even the cloud. Benefits of containers include:

  • Application-centric management: Raises the level of abstraction from running an OS on virtual hardware to running an application on an OS using logical resources.
  • Less overhead: Containers require less system resources than traditional or hardware virtual machine environments because they don’t include operating system images.
  • More consistent operation: DevOps teams know applications in containers will run the same, regardless of where they are deployed.
  • Greater efficiency : Containers allow applications to be more rapidly deployed, patched, or scaled.
  • Better application development: Containers support agile and DevOps efforts to accelerate development, test, and production cycles.
  • Observability : Not only OS-level information and metrics, but also application health and other signals.
  • Cloud and OS distribution portability: Runs on Ubuntu, RHEL, CoreOS, on-prem, Google Kubernetes Engine, and anywhere else.

Container Use Cases

Common ways organizations use containers include:

  • “Lift and shift” existing applications into modern cloud architectures. Some organizations use containers to migrate existing applications into more modern environments. While this practice delivers some of the basic benefits of operating system virtualization, it does not offer the full benefits of a modular, container-based application architecture.
  • Provide better support for micro-services architectures. Distributed applications and micro-services can be more easily isolated, deployed, and scaled using individual container building blocks.Containers work best for service based architectures. Opposed to monolithic architectures, where every pieces of the application is intertwined — from IO to data processing to rendering — service based architectures separate these into separate components.
  • Provide DevOps support for CI/CD. Container technology supports streamlined build, test, and deployment from the same container images.
  • Provide easier deployment of repetitive jobs and tasks. Containers are being deployed to support one or more similar processes, which often run in the background, such as ETL functions or batch jobs.

What is Virtualization? Is Containerization same or different?

Before containers gained popularity, a prior approach was virtual machines. Here, one physical server was able to be used for multiple applications via virtualization technology, also known as a virtual machine, where each virtual machine contains the entire operating system, as well as the application to run.

Virtual machines (VMs) are an abstraction of physical hardware turning one server into many servers. The hypervisor allows multiple VMs to run on a single machine. Each VM includes a full copy of an operating system, the application, necessary binaries and libraries — taking up tens of GBs. As shown in the above quick video, the physical server than runs several virtual machines, each with its own OS, with a single hypervisor emulation layer on top. By running several OS’ simultaneously, there is a lot of overhead on the server as resources get used, and the number of virtual machines is limited to but a few.

Where as Containers are an abstraction at the app layer that packages code and dependencies together. Multiple containers can run on the same machine and share the OS kernel with other containers, each running as isolated processes in user space. Containers take up less space than VMs (container images are typically tens of MBs in size), can handle more applications and require fewer VMs and Operating systems.

Like virtual machines, containers allow you to package your application together with libraries and other dependencies, providing isolated environments for running your software services. However, the similarities end here as containers offer a far more lightweight unit for developers and IT Ops teams to work with, carrying a myriad of benefits. Instead of virtualizing the hardware stack as with the virtual machines approach, containers virtualize at the operating system level, with multiple containers running atop the OS kernel directly. This means that containers are far more lightweight: they share the OS kernel, start much faster, and use a fraction of the memory compared to booting an entire OS.

What is Docker and Kubenetes (k8s) then?

From the above figure, containers run time is the one on which multiple apps and their dependencies are deployed as containers. Users involved in container environments are likely to hear about two popular tools and platforms used to build and manage containers. These are Docker and Kubernetes.

Docker is a popular runtime environment used to create and build software inside containers. It uses Docker images (container images become containers at runtime) to deploy containerized applications or software in multiple environments, from development to test and production. Docker was built on open standards and functions inside most common operating environments, including Linux, Microsoft Windows, and other on-premises or cloud-based infrastructures. In a nutshell, to containerize any application, you need to build it on Docker as Container runtime.

Containerized applications can get complicated. Many might require hundreds to thousands of separate containers in production. This is where container runtime environments such as Docker benefit from the use of other tools to orchestrate or manage all the containers in operation. One of the most popular tools for this purpose is Kubernetes, a container orchestrator. Kubernetes orchestrates the operation of multiple containers in harmony together.

Kubernetes is an open source orchestration system for automating the management, placement, scaling and routing of containers that has become popular with developers and IT operations teams in recent years. It was first developed by Google and contributed to Open Source in 2014, and is now maintained by the Cloud Native Computing Foundation.

It manages areas like the use of underlying infrastructure resources for containerized applications such as the amount of compute, network, and storage resources required. This container orchestration tool makes it easier to automate and scale container-based workloads for live production environments. Kubernetes makes everything associated with deploying and managing your application easier. It also continuously runs health checks against your services, restarting containers that fail or have stalled, and only advertising services to clients when it has confirmed they’ve started up successfully. Additionally, Kubernetes will automatically scale your services up or down based off of utilization, ensuring you’re only running what you need, when you need it

Why use Kubernetes?

Kubernetes has become the standard orchestration platform for containers. All the major cloud providers support it, making it the logical choice for organizations looking to move more applications to the cloud.

Kubernetes provides a common framework to run distributed systems so development teams have consistent, immutable infrastructure from development to production for every project. Kubernetes can manage scaling requirements, availability, failover, deployment patterns, and more.

Kubernetes’ capabilities include:

  • Service and process definition
  • Service discovery and load balancing
  • Storage orchestration
  • Container-level resource management
  • Automated deployment and rollback
  • Container health management including Self-healing
  • Secrets and configuration management
  • Automatic scaling of services
  • Deploy anywhere, including hybrid deployments

As Google rightly depicted below, perhaps most importantly, Kubernetes is built to be used anywhere, allowing you to orchestrate across on-site deployments to public clouds to hybrid deployments in between. This enables your infrastructure to reach your users where they’re at, your applications to have higher availability, and your company to balance your security and cost concerns, all tailored to your specific needs including multi cloud support.

Summary

If Container is to simplify the application development and deployment on cloud platforms, Docker is one such Container runtime on which each container run as a packaged app and its dependencies. If there are multiple such apps in form of containers are present, we need a container management platform and Kubernetes is one such which takes care of auto deployment to scaling to resource management etc with even multi cloud support.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store