0% found this document useful (0 votes)
239 views47 pages

Virtualization Vs Containerization Vs Orchestration

Container orchestration involves automating the deployment, scaling, networking, and management of containers. Kubernetes is an open-source container orchestration tool developed by Google that helps manage containerized applications across multiple hosts. It provides mechanisms for self-healing, auto-scaling, load balancing, and failure recovery of containers.

Uploaded by

Riyas Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
239 views47 pages

Virtualization Vs Containerization Vs Orchestration

Container orchestration involves automating the deployment, scaling, networking, and management of containers. Kubernetes is an open-source container orchestration tool developed by Google that helps manage containerized applications across multiple hosts. It provides mechanisms for self-healing, auto-scaling, load balancing, and failure recovery of containers.

Uploaded by

Riyas Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 47

Virtualization vs Containerization vs

Container Orchestration
Sundararajan T
• Virtualization is a technology that lets
you create useful IT services using
resources that are traditionally bound to
hardware.
Virtualization
• It allows user to use a physical machine’s
full capacity by distributing its
capabilities among many users or
environments.
Virtualization Architecture

Applications Applications Applications Applications

Guest OS Guest OS Guest OS Guest OS


(Windows) (Linux) (Windows) (Unix)

Virtual Machine Virtual Machine Virtual Machine Virtual Machine

VIRTUAL MACHINE MANAGER

HOST OS

HARDWARE
Types of Virtualization

Desktop Virtualization Server Virtualization Network Virtualization

Application Virtualization Storage Virtualization


• The utility which makes virtualization
possible is called as Hypervisor
• Hypervisor also called as Virtual
Machine Manager
• The virtual computers that are created
Hypervisor using Hypervisor are commonly called
as Virtual Machines (VMs)
• Types of Hypervisor
o Type 1
o Type 2
Hypervisor Architecture
Type – 1 / Bare metal Hypervisor Type – 2 Hypervisor

Guest OS Guest OS

Guest OS Guest OS Hypervisor

Hypervisor Host OS

Hardware Hardware
Benefits of Hypervisors

• Lower cost
• Less Infrastructure
• Platform independent
• Speed
• Efficiency
• Minimal downtime
• Isolation
Containerization
• Containerization is a form of virtualization where
applications run in isolated user spaces, called
containers, while using the same shared operating
system (OS).
• Everything an application needs to run (its binaries,
libraries, configuration files, and dependencies) are
encapsulated and isolated in its container.
• Each container is an executable package of software,
running on top of a host OS.
• Commonly used container is Docker
Virtual Machines VS Containers

APP 1 APP 2 APP 3

bin/libs bin/libs bin/libs

APP 1 APP 2 APP 3


GUEST OS GUEST OS GUEST OS
bin/libs bin/libs bin/libs

HYPERVISOR DOCKER ENGINE

HOST OS HOST OS

HARDWARE HARDWARE
Docker
• Docker is an open platform for developing, shipping, and
running applications.
• Docker enables you to separate your applications from
your infrastructure so you can deliver software quickly.
• No more - “It works on my machine”
• Technology Independent
• Improved developer productivity
• Lightweight
IMAGE CONTAINER
Docker image is the image which contains the A Docker container is a virtualized run-time
source code, libraries, dependencies, tools and environment where users can isolate applications
other files needed for an application to run from the underlying system.

Due to their “read only” nature, these images are These containers are compact, portable units in
also called as a snapshot which you can start up an application quickly and
easily.

These are like templates which you cannot start or These containers run using the docker images
run the them. which is pulled locally or from the hub / registry

docker pulls images from Docker Hub. It is also We can run multiple container instance of the same
possible to manually specify the path of a registry image without any issues.
to pull from. For example, if you have set up a local
registry, you can specify its path to pull from it.
Docker Architecture
CLIENT DOCKER HOST REGISTRY

docker build Docker daemon

docker pull containers Images

docker run
Installing Docker

• Docker Desktop for Windows


• Docker Desktop for Mac (macOS)
• Command line for Linux
• sudo apt-get install docker-ce docker-ce-cli
containerd.io
• Play with docker (https://labs.play-with-docker.com/)
Pulling an image

• To pull the images to the local machine you can use the below command
• Syntax
• docker image pull <image_name>
Running a container
exec command

• Exec command is useful to


enter the container as bash
or any other shell
• Syntax
$ docker container exec -
it <container-name>
<application/shell name>
• We can delete the images from our local machine using the below
command
• Note: We cannot delete the image which is being used by any container
Deleting Image that is running
• Syntax:
$ docker image rm <image_name>
• We can cleanup the container only by
Stopping & removing the containers
• Containers that are running can’t be
Removing the removed, so we need to stop the container
first in order to remove

Container • Syntax
$ docker container stop <container_name>
$ docker container rm <container_name>
BUILD SHIP RUN

Run the app container


Ship the Docker
Develop an app using from the docker image.
container image and
Docker containers with Scale the app from 1 to
dependencies
any language and any 1000 without hassle.
anywhere – to QA,
toolchain. Build it as Move it freely between
teammates, or the
Docker Image clouds. Update the app
cloud
with zero downtime
Dockerfile is a text file with set of
commands to be executed while building
the image

The text file should be named only as


Dockerfile without any extensions
Dockerfile

The file contains instructions like the Image


to be pulled, Files to be copied, commands
to be run while building the Image
1. Create a simple homepage with
HTML
2. Write the Dockerfile with required
build instructions
3. The homepage should be copied to Deploy nginx
the image
4. Build to create the customized
webserver
nginx webserver image
5. Finally, run the container using the
image created
Index.html Dockerfile

FROM –
Specify base COPY – Copying the index file
image to nginx html directory within
image

Building the image


1 2 3

1. As soon as build is triggered Docker creates the customized image


2. We are running the docker image as container using this command
• Syntax: docker container run --name [name_of_container] -d -p [LocalPort]:[ContainerPort] [image_name]
• --name is the container name
• -d tells to run the container in detached mode
• -p to publish the local machine port to container port
3. The port binding between the local machine and container
Nginx
webserver
up &
Running
Create Create python app.py main file with simple python flask code

Create Create requirement.txt file to include the flask dependency


modules

Building a Create Create Dockerfile with python base image and copy the files

Python web app


Build Build the image with version tag

Run Run the image as container


The three files we need to create

Python flask app.py file Dockerfile with build instructions

requirements.txt file with dependencies


Build the
image
Tag the image
• Tagging an image is essential to maintain the version of the image
• The tagging will not create new image, only the Tag value pointed to the actual
image
• Syntax
docker tag [imagename]:[tag] [imagename]:[version]
Run the container
Few other docker utilities

• Docker network
• Docker logs
• Docker volume
• Docker swarm
• Docker compose
• Docker hub
• Docker registry
Container
Orchestration
• Container orchestration automates the
provisioning, deployment, networking,
scaling, availability, and lifecycle
management of containers
• Docker swarm, Kubernetes
• open-source container orchestration tool
• Developed by Google
• Helps to manage containerized application
• Supports containerd, CRI-O, docker and any other
implementation of the Kubernetes CRI (Container
Runtime Interface).
• Docker Desktop for Windows have
Kubernetes Kubernetes
Installation • Native Package installation in Linux
• Brew package manager in MAC
• Play with K8s
• https://labs.play-with-k8s.com/
Why Kubernetes?

• Trend from Monolith to Microservices


• Increased use of Containerized application
• Proper way to manage hundreds of containers
• High availability / very minimal downtime
• scalability and high performance
• Disaster recovery - Backup and restore
Kubernetes Architecture

Scheduler kubelet
Worker Node 1
kubeproxy

kubectl

pod
API API Server
Container
GUI Worker Node 2

Control Cluster
etcd Manager

Master Node Worker Node 3


Node POD
my-app  Smallest unit in Kubernetes
IP

 Abstraction over container


 Usually, 1 application per pod
DB
IP  Each pod gets its own IP address
 New IP address on re-creation of pod
secrets
DB_USER = mongo-user Service
DB_PWD = mongo-pwd  Permanent IP address
configmap  Each pod can be bound to a service
 Though pod restarts IP or service will not be changed or affected
DB_URL = mongo-db-service

Node
INGRESS
Ingress
 provides routing rules to manage external access to services
my-app
SERVICE Configmap
 External configuration of your application
Mongo-db  Not recommended for confidential data

Secrets
 Used to store secret data
DB  Data would be encoded base64 by default
SERVICE
Volume
 Storage on local or remote, outside of K8s cluster
VOLUME
 Data will not be destroyed while pod scaled down
Replication

Node 1 Node 2  Permanent IP


 Create Replication if one node is down
 Load balancer
my-app my-app
SERVICE
Deployment
 Blueprint for your application pod
 Specify how many replicas you want to have
 You can scale up or scale down the replicas of the
pod using deployment
DB DB  Abstraction of Pod
SERVICE

Statefulset
 Databases can’t be replicated with deployment
due to its State and avoid data inconsistency
 Statefulset used for DBs
Example Deployment with Kubernetes

1 2 3 4
Creating required Building an Image Creating the Deploying the
files to build image with tag Kubernetes application with
Deployment the manifest file
manifest file
(YAML)
app.py index.html

Requirements.txt

Dockerfile
Build the image
• kind – specify what kind of Kubernetes object going to be created
• metadata – contains name of the deployment
• labels – key, value pair attached to the resource

• spec – object used to provide the description of the resources


• replicas – number of resource to be created
• selector –matches to the label
• containers – specify the container name, image name, port etc

• service object can be created in different file or in same file separated by ---
• NodePort – to access the application externally
• Port – service port
• targetPort – Container port
• nodePort – Port used to access externally
• Virtualization
• Hypervisor, types of hypervisor and its architecture
• Benefits of Hypervisor
• Containerization
• Difference between containerization and virtualization
• Docker, Docker Image and Docker container
• Docker architecture

Summary • Example of pulling image and running a container


• Several docker commands like exec, rm, stop containers
• Build, ship and Run with Dockerfile
• Container orchestration
• Kubernetes, Kubernetes architecture and its benefits
• Pods, service, ingress, Configmap, Secrets, and volume
• Replication, Deployment and stateful set
• Deployment of simple flask application
Thank you!

You might also like