Containerization World with Docker and Kubernetes for Beginners

Leandro Last Updated : 08 Sep, 2022
5 min read

This article was published as a part of the Data Science Blogathon.

Introduction

We go back in time to discuss the history of containers and virtualization. It’s important to bear in mind that the containers can exist because of the possibility of the machines being virtualized. I will reinforce this because we talk about the differences between the host in virtualized vs. container environment. Therefore, it’s important to know that both are use cases that can be used for each project type.

A Short History

The history beginnings with the technology that introduces virtualization, where the project V-Server has developed by Jacques Gélinas in the year 2002, these make it possible to run several Linux servers in a box with independence and security. In the same year, the Linux Kernel received an important update that years later will have gone made it possible to build containers how we know them today. This update introduces namespaces. With these, it’s possible to run a process isolating these from others using global resources, and containers use these in your core functionality.

To understand containers, we will explain the basics of how this architecture works and the differences between the virtualized machines.

Virtual Machines

The virtualized machine is a layer between the hardware and the emulated Operational System that run applications. We will use web apps; for example, in the image below, we can see how this architecture works.

virtual machines
Virtualization Model

This model is used by hosts to up services to be accessed by sharing resources of a server between various virtualized O.S in unique machine hardware. In the image above, we can see an important component responsible for providing installation of different O.S over the host base O.S; this component is the hypervisor.

docker model
Virtualization Hypervisor

This technology provides many benefits to infrastructure costs with hardware resource allocation optimization and provides the environment to able containers possible.

Containers with Docker

The containers you see above can run isolated processes on the same machine; virtualized containers use fewer resources to up an application environment because the container engine runs over the O.S layer and provides isolation of many resources instead of using the entire O.S environmental resources. An example of architecture is the docker, which you can see in the image below.

docker model | Kubernetes
Containerization Docker Model

The docker container has many things we can mention, but the docker image is the main component; these images can be deployed to a docker repository of artifacts on DockerHub or private Enterprise.

Kubernetes

Docker needs an orchestrator to manage the images, networks, and many other features. Here, we introduce the Kubernetes or K8s(eight letters between K and S). The Kubernetes has the docker into your architecture performing an easy-to-use way of containers and services that containerization provides us. In the image above, we can see a structure of K8s.

Kubernetes
K8s Architecture

We can see that k8s incorporate docker in a layer responsible for the containers running into a Pod. The Pod is a set of one or more Linux containers and is the basic unit of K8s.

Controlling Nodes of Kubernetes

To understand the power of Kubernetes, we need to understand how it controls the big ecosystem of nodes providing a powerful environment for teams to build fault tolerance for your microservices, databases, and applications.
In the last section, we represent the k8s architecture with a figure to represent where docker is present on this system; this has an important agent that we need to figure out and call, in this case, Master Node; this can be referred to more recently on k8s documentation as Control Plane Node. Their role remains the same, providing the running environment to control plane agents to manage the state of the Kubernetes cluster, providing control, scheduling, and interface for access for the k8s node’s resources, therefore providing your maintenance of stability and High Availability across the easy way of the store the current state of the resources on the cluster.

Main Components in Kubernetes Architecture

We will introduce in this section any components of Kubernetes that make the magic for us by providing a developer-friendly system for containerizing complex applications.
  • API Server
    Is responsible for providing an interface across a REST API for accessing the cluster resources and operations for different role levels, i.e. developers, administrators, and other agents.
  • Controller Managers
    Watch components on the Kubernetes cluster to provide the desired state, acting as manager of nodes states during k8s cluster operation.
  • etcd
    It is a key-value data store used to save Kubernetes state. This is not a simple feature once it provides the data transfer between distributed clusters, building the desired High Availability for the systems.
  • Scheduler
    The Kube-scheduler has an important role in scheduling nodes into a Kubernetes container making decisions based on the cluster state data stored.
Kubernetes has many other components, but these are the main ones, and you can see about the others if you desire on Kubernetes documentation.

Conclusion

Kubernetes architecture solves many of the problems with some concepts that improve the best of the containerization fundamentals that docker efficiently implemented. It helps the usage of computational resources smartly by providing short-size images that allow building robust systems with low memory and CPU different than we had on virtualized machines.

This tutorial aimed to introduce the concept of containerization, and we can conclude that it is not hard to understand the background of Kubernetes and docker. Now you can check the references and explore more and learn how to migrate or build your systems for the containerized side that will turn it fast to scale and distribute for your customers.

In this tutorial, you learned:

  • The introduction of the namespace on Linux Kernel that allows the build of Docker and other container-based systems;
  • The contrast between virtualized and containerized approaches;
  • Basic of Docker architecture layers;
  • Basic components of the Kubernetes architecture;
The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.

DevOps Automation Engineer and Researcher in A.I field. My purpose is improve infrastructure automation tasks using A.I approach to optimize costs and performance inside cloud native environments.
Also has experience with financial prediction and missing data handling.

Responses From Readers

Clear

Congratulations, You Did It!
Well Done on Completing Your Learning Journey. Stay curious and keep exploring!

We use cookies essential for this site to function well. Please click to help us improve its usefulness with additional cookies. Learn about our use of cookies in our Privacy Policy & Cookies Policy.

Show details