0% found this document useful (0 votes)
4 views29 pages

CIS Module-2 Notes

The document provides comprehensive notes on Cloud Infrastructure and Services focusing on virtualization, its types, advantages, and disadvantages. It explains key concepts such as the virtualization layer, hypervisors, and various virtualization techniques like hardware, OS, server, storage, network, application, and desktop virtualization. Additionally, it highlights the importance of virtualization in cloud computing for efficient resource utilization, cost reduction, scalability, and security.

Uploaded by

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

CIS Module-2 Notes

The document provides comprehensive notes on Cloud Infrastructure and Services focusing on virtualization, its types, advantages, and disadvantages. It explains key concepts such as the virtualization layer, hypervisors, and various virtualization techniques like hardware, OS, server, storage, network, application, and desktop virtualization. Additionally, it highlights the importance of virtualization in cloud computing for efficient resource utilization, cost reduction, scalability, and security.

Uploaded by

sahasrakona
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

CLOUD INFRASTRUCTURE AND SERVICES (24CS2204)


Module-2 Notes
Syllabus:
Virtualization, Characteristics of virtualized environments. Taxonomy of virtualization
techniques, Hardware and OS level virtualization techniques. Pros and cons of virtualization.
Virtualization Technology Examples: Xen- para virtualization, VMware: full virtualization,
Microsoft Hyper-V. Introduction to Containerization: VMs vs Containers, Docker Architecture,
Container Images, Registries. Introduction to Kubernetes: Pods, Deployments, Services
(conceptual only).

Virtualization:
Virtualization in Cloud Computing:
Virtualization Definition:
Virtualization means creating a virtual (not real) version of computing resources such as a
server, operating system, storage, or network.
In simple words, virtualization allows one physical computer to act like multiple computers.
Instead of giving one physical machine to one user, virtualization shares a single physical
system among many users by creating multiple virtual environments.
(OR)
Virtualization is the process of creating a virtual version of computing resources like hardware,
software, storage, or network.
Virtualization has three main components:
• Host machine – The real physical machine
• Guest machine – virtual machine created on the physical machine. Each guest machine
works like a real computer, has its own OS and applications, is isolated from other
virtual machines.
• Virtualization Layer (Hypervisor) – software that connects the guest to the host and
manages resources
Virtualization allows multiple systems to run on a single physical machine efficiently.
(OR)
Virtualization is a technology that allows multiple virtual machines to run on a single physical
machine by sharing hardware resources efficiently.
Instead of giving one physical machine to one user, virtualization shares a single physical
system among many users by creating multiple virtual environments.

1
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Virtualization Architecture
Virtualization Layer/Hypervisor/Virtual Machine Monitor:
• It is an interface or a monitoring system in virtualization layer to present a virtual
operating platform to a guest operating system.
• There are two types of hypervisors.
• Type- 1 Hypervisor
• Type- 2 Hypervisor
Type- 1 Hypervisor Type- 2 Hypervisor

Known as Bare Metal or Native Hypervisor Known as Hosted Hypervisor


Hypervisor run directly on the host hardware and Hypervisor run on the top of the conventional
control the hardware and monitor the guest operating system and monitor the guest operating
operating system. system.

2
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

OR OR

Examples: Citrix Xen Server, Oracle VM, Examples: VMWare Workstation, Oracle Virtual
VMWare ESX/ESXi, Hyper-V. Box.

Need of Virtualization in Cloud Computing:


Virtualization is a core technology that makes cloud computing possible. It allows a single
physical machine to be divided into multiple virtual machines (VMs), each working
independently.
1. Efficient Resource Utilization
Virtualization enables better use of hardware resources such as CPU, memory, and storage.
Instead of one application using one physical server, multiple virtual machines can run on the
same server, reducing wastage.
2. Cost Reduction
By running multiple VMs on a single physical system, organizations reduce the need for
additional hardware, power consumption, cooling, and maintenance—leading to lower
operational costs.
3. Scalability and Flexibility
Virtualization allows quick creation, modification, or deletion of virtual machines. Cloud
providers can easily scale resources up or down based on user demand.
4. Isolation and Security
Each virtual machine is isolated from others. If one VM fails or is compromised, it does not
affect other VMs running on the same physical server, improving system reliability and
security.
5. High Availability and Fault Tolerance

3
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Virtual machines can be backed up, migrated, or restored easily. If a physical server fails, VMs
can be moved to another server with minimal downtime.
6. On-Demand Resource Provisioning
Virtualization enables cloud services to be provided on-demand. Users can instantly access
servers, storage, and applications without worrying about underlying hardware.
7. Simplified Management
Centralized management of virtual machines makes monitoring, maintenance, and updates
easier for cloud service providers.

Characteristics of virtualized environments:


Increased Security
Virtualization provides a secure and controlled environment by isolating each guest system.
Managed Execution
It allows better control of execution using features like sharing, isolation, emulation, and
aggregation.
Portability
Virtual machines can be easily moved and run on different physical systems using virtual
images.
Aggregation
Multiple physical machines can be combined and presented as a single virtual system using
clustering.
Emulation
Virtualization can imitate different hardware or environments, allowing programs to run even
if the host system does not support them.
Isolation
Each virtual machine runs in its own separate environment, so problems in one VM do not
affect others.
Resource Sharing
Multiple virtual machines share the same physical resources like CPU, memory, storage, and
network efficiently.
Flexibility
Virtual machines can be easily created, modified, or removed without changing physical
hardware.
Hardware Independence
Virtual machines are not tied to specific hardware and can be moved across different physical
systems easily.
Scalability
Virtualization allows resources to be increased or decreased easily based on business needs.

4
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Management
Centralized tools help administrators monitor and manage multiple virtual machines from a
single console, making maintenance easier.
Disaster Recovery
Virtual machines can be quickly backed up and restored from remote locations, enabling fast
recovery during failures.
Testing and Development
Virtualization helps create testing and development environments easily without extra
physical hardware.
Energy Efficiency
Virtualization reduces power consumption by running multiple virtual machines on fewer
physical servers.
Increased Uptime
Virtual machines can be moved to another physical system during hardware failure, reducing
downtime.
Cost Savings
It lowers hardware, power, and maintenance costs, resulting in long-term savings.
Cloud Migration
Virtualization makes it easier to move existing systems to the cloud and use cloud services.

Pros (Advantages) of Virtualization:


• Better Resource Utilization
Multiple VMs share CPU, memory, storage, and network efficiently.
• Cost Reduction
Fewer physical servers → lower hardware, power, and maintenance costs.
• Scalability & Flexibility
VMs can be created, modified, or deleted quickly.
• Isolation & Security
Failure or attack in one VM does not affect others.
• Easy Backup & Disaster Recovery
VM snapshots and images simplify recovery.
• High Availability
Supports live migration and fault tolerance.
• Faster Development & Testing
Different OS environments can run on the same machine.

Cons (Disadvantages) of Virtualization:


• Performance Overhead
Slight performance loss compared to running directly on hardware.
• High Initial Setup Cost
Requires powerful hardware and licensed hypervisors.

5
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

• Complex Management
Needs skilled administrators and monitoring tools.
• Single Point of Failure
If the host fails, all VMs may go down.
• Security Risks at Hypervisor Level
A compromised hypervisor affects all VMs.
• Resource Contention (competition for shared resources)
Poor allocation can degrade VM performance.
• Dependency on Hypervisor
If the hypervisor fails, multiple VMs can be affected.

Types of Virtualization/ Taxonomy of Virtualization Techniques:


• Virtualization techniques are classified based on what resource is virtualized—
hardware, OS, server, storage, network, or application.
• Cloud computing mainly uses these types of virtualization techniques.
• Hardware Virtualization
• Operating System Virtualization
• Server Virtualization
• Storage Virtualization
• Network Virtualization
• Application Virtualization
• Desktop Virtualization
• Hardware Virtualization – Virtual machines run directly on physical hardware using
a hypervisor.
• OS-Level Virtualization – Multiple virtual environments share the same operating
system kernel.
• Server Virtualization – One physical server is divided into multiple virtual servers.
• Storage Virtualization – Multiple storage devices are combined into one logical
storage.
• Network Virtualization – Virtual networks are created over physical networks.
• Application Virtualization – Applications run in isolated virtual environments.
• Desktop Virtualization- Virtual desktop environment (operating system,
applications, and user data) is hosted on a centralized server or cloud infrastructure.

1. Hardware Virtualization
• Hardware Virtualization occurs when virtual machine software (called Hypervisor or
VMM) is installed directly on the physical hardware.
• Each VM behaves like a separate computer with its own OS.

6
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

• Full Virtualization and Para Virtualization are the two types of Hardware Virtualization
techniques.

Full Virtualization Para Virtualization


Guest OS is unaware of the underlying Guest OS is aware of the virtualization layer.
hardware.
Hypervisor fully manages resources. Improves performance via collaboration with hypervisor.
Example: VMware ESXi, Microsoft Example: Citrix Xen
Hyper-V

Usage:
• Managing multiple virtual machines is easier than managing multiple physical
servers.
• It improves scalability and performance in data centers.
Use Case: Cloud servers, data centers, running multiple OS on one physical server.
1. Operating System Virtualization (Containerization)
Operating System Virtualization happens when the virtual machine software (VMM /
Hypervisor) is installed on top of the Host Operating System, instead of directly on the
hardware.
• Multiple isolated virtual environments (containers) share the same host OS kernel.
• The Host OS sits between the host machine hardware and the virtual machines.
• Multiple isolated virtual environments (containers) share the same host OS kernel.
• Virtual machines run as applications on the host OS.

7
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Purpose:
• Lightweight virtualization for running applications efficiently without full OS overhead.
Technologies:
• Docker: Packages applications and dependencies into containers.
• Kubernetes: Orchestrates and manages containers (deployment, scaling, management).
Use case:
Microservices, application development/testing, cloud-native apps.
2. Server Virtualization
• Server Virtualization occurs when a single physical server is divided into multiple
virtual servers using virtualization software.
• Each virtual server works independently.
• Resources are allocated to virtual servers based on demand.

Usage:
• Load balancing

8
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

• Better utilization of server resources


• Cost reduction
• One physical server behaves like many servers
Example:
One physical server hosting separate servers for database, application, and web services.
3. Storage Virtualization
• Storage Virtualization is the process of combining storage from multiple physical
storage devices and presenting it as one single storage unit.
• Implemented using software
• Users do not see the actual physical location of data

Usage
• Data backup
• Disaster recovery
• Easy storage management
• Improved data availability

4. Network Virtualization:
• Network virtualization is a method of combining the available resources in a network to
consolidate multiple physical networks, divide a network into segments or create software
networks between VMs.
• IT teams can use network virtualization to create multiple isolated virtual networks that
share the same underlying physical infrastructure.
• Network hypervisor creates an abstraction layer that hosts and supports different virtual
networks.
• The hypervisor is not only responsible for abstraction, but also controls the resources,
bandwidth and capacity for each virtual network.

9
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

5. Application Virtualization:
Application Virtualization is a cloud computing technique in which applications are
separated from the underlying operating system and hardware. Instead of being installed
directly on a user’s device, applications run in isolated virtual environments and are
delivered to users on demand through the cloud.

In cloud environments, application virtualization enables centralized application


management, improved portability, and efficient resource utilization. Applications can be
deployed, updated, and scaled quickly without affecting the host system.

This approach reduces compatibility issues, enhances security through isolation, and
supports remote access.

Use cases:

Used in enterprises for remote working, software testing, educational labs, and large-scale
application deployment.

10
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

6. Desktop Virtualization
Desktop Virtualization is a technology in which a user’s desktop environment (operating
system, applications, and user data) is hosted on a centralized server or cloud infrastructure
instead of running locally on a physical machine. Users access their desktops remotely through
thin clients, laptops, or mobile devices over a network.

In cloud computing, desktop virtualization enables centralized management, improved


security, and easier maintenance of desktops. Since data and applications remain in the data
center or cloud, risks related to data loss and unauthorized access are reduced. It also supports
scalability, allowing organizations to quickly provision or de-provision desktops based on
demand.
Use Cases:
Used in enterprises, educational institutions, call centers, and remote working environments.
X86 Architecture:
• It is Most commonly used CPU architecture, used in desktops, laptops, and servers
and developed by Intel and AMD.
• In x86 processor architecture, the CPU provides four privilege levels, called rings, to
protect the hardware and maintain system security.
• Ring 0 (Kernel Mode):
Used by the OS kernel. Has full access to hardware, memory, and CPU. Runs critical
system code.
• Ring 3 (User Mode):
Used by applications. Has limited access and must use system calls to request OS
services.
• Rings 1 & 2:
Mostly unused in modern operating systems to reduce complexity.

11
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

x86 processors use privilege rings to protect hardware. Ring 0 is for the kernel and Ring 3 is
for applications.
If user want to run multiple operating systems on the same hardware. Each OS thinks it
should run in Ring 0.
Multiple OS → All want Ring 0
Introduce a new software layer called a hypervisor. In virtualization, the hypervisor takes
Ring 0, and the guest operating system is pushed down to a lower ring.
Ring 0 → Hypervisor
Ring 1 → Guest OS
Ring 3 → Applications
• In x86 systems, some CPU instructions work only in Ring 0 (highest privilege).
• x86 processors were designed assuming only one operating system runs in Ring 0.
• Privileged instructions: Instructions related to memory management, CPU
control, Hardware access.

Virtualization Technology Examples:


Xen: paravirtualization:
• Xen is an open-source virtualization platform that has gained significant attention in
the world of virtualization. It was initially developed at the University of
Cambridge and is now maintained by the Xen Project, a collaborative community of
developers. It is either used for desktop or server virtualization.

• Xen follows paravirtualization technology. Paravirtualization is a virtualization


technique that involves modifying the operating system (OS) running inside a virtual
machine (VM) to make it aware of its virtualized environment. Unlike full

12
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

virtualization, where the guest OS is unaware of the virtualization layer and runs
unmodified, paravirtualization requires changes to the guest OS to improve
performance, security, and efficiency. Example: XenoLinux is a modified Linux OS
that runs on Xen hypervisor.

The Architecture of Xen


Above figure describes the Xen Architecture and its mapping onto a classic x86 privilege
model. A Xen based system is handled by Xen hypervisor, which is executed in the most
privileged mode and maintains the access of guest operating system to the basic hardware.
Guest operating system are run between domains, which represents virtual machine instances.
Various x86 implementation support four distinct security levels, termed as rings, i.e.,
Ring 0, Ring 1, Ring 2, and Ring 3.
Here,
Ring 0 represents the level having most privilege and
Ring 3 represents the level having least privilege.
• Almost all the frequently used Operating system, except for OS/2, uses only two levels i.e.
• Ring 0 for the Kernel code and Ring 3 for user application and non-privilege OS program.
• This provides a chance to the Xen to implement paravirtualization.
• This enables Xen to control unchanged the Application Binary Interface (ABI) thus allowing
a simple shift to Xen-virtualized solutions, from an application perspective.
Pros of Xen:
1. High Performance: Xen’s paravirtualization approach often results in better
performance compared to full virtualization methods.

13
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

2. Strong Isolation: Xen offers strong isolation between virtual machines, which
enhances security and stability.
3. Open Source: Xen is open-source software, making it a cost-effective choice for
organizations looking to implement virtualization without significant licensing costs.
4. Live Migration: Xen supports live migration, allowing virtual machines to be moved
between physical hosts with minimal downtime.
5. Compatibility: Xen supports a wide range of operating systems as both guests and
hosts, making it versatile and suitable for various use cases.
Cons of Xen:
1. Complex Configuration: Xen can be complex to set up and configure, especially for
beginners.
2. Limited Desktop Virtualization Support: While Xen can be used for desktop
virtualization, it is not as well-optimized for this purpose as some other virtualization
platforms.
3. Hardware Support: Hardware support can be a limitation. Xen relies on hardware
virtualization extensions (Intel VT-x or AMD-V) for certain features.
4. Integration and Compatibility: Integrating Xen with certain management tools or
integrating Xen-based VMs with other virtualization platforms may be more
challenging due to the specific paravirtualization features.

VMware: Full Virtualization


• VMware is built upon the principle of full virtualization, which involves duplicating
the underlying hardware and presenting it to the guest OS. The guest OS operates
without any awareness of this abstraction layer and requires no modifications.
• Full virtualization is a virtualization technique that allows multiple virtual machines
(VMs) to run on a single physical host without modifications to the guest operating
systems. In a fully virtualized environment, each virtual machine operates as if it has
its own dedicated physical hardware, even though it shares resources with other VMs
on the same host.
• Ring 3 – User Applications
• Ring 2 – (Unused)
• Ring 1 – Guest OS (De-privileged)
• Ring 0 – Hypervisor
• Ring 0 → Highest privilege (direct hardware access)
• Ring 3 → Lowest privilege (user applications)
• In a normal system, the OS runs in Ring 0.
• In VMware full virtualization, the hypervisor takes Ring 0, and the guest OS is
pushed to Ring 1.

14
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

The Architecture of Full virtualization


User Applications (Unmodified ABI)
Applications run in Ring 3
They are completely unmodified
Applications do not know they are running inside a VM
Pros of VMware:
1. Highly Reliable: VMware has a strong reputation for reliability. It’s widely used in
enterprise environments where system uptime is critical.
2. Performance: VMware’s virtualization technology is known for its high performance.
Their hypervisor, ESXi, is designed for efficiency and speed.
3. Security: VMware provides security features to protect virtualized environments. This
includes features like vSphere Security, which enhances the security of VMs and their
communication.
4. Management Tools: VMware offers a comprehensive set of management tools.
VMware vCenter Server allows administrators to manage and monitor virtual
environments from a central location, providing a robust set of features for resource
management and performance optimization.
5. Live Migration: VMware supports live migration of virtual machines, enabling
seamless movement of workloads from one host to another with minimal downtime,
which is essential for load balancing and hardware maintenance.

6. Wide Guest OS Support: VMware supports a wide range of guest operating systems,
making it versatile for different types of workloads and applications.

15
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Cons of VMware:
1. Cost: One of the significant drawbacks of VMware is the cost. VMware’s products can
be expensive, especially for smaller organizations. Licensing costs can add up quickly.
2. Resource Intensive: While VMware is known for its performance, it can be resource-
intensive. The hypervisor and management tools may require dedicated hardware and
resources, which can impact the overall infrastructure costs.
3. Vendor Lock-In: There’s a concern that once an organization heavily invests in
VMware’s ecosystem, it may be challenging to migrate to other virtualization platforms
due to vendor lock-in.

Microsoft Hyper-V:
• It is a virtualization technology and hypervisor developed by Microsoft. It allows you to
create and manage virtual machines (VMs) on Windows-based servers.
• It runs directly on physical hardware, supports both Windows and Linux guest operating
systems, and requires CPU-level virtualization support.
• Hyper-V is commonly used in data centers, enterprise environments, and cloud services to
consolidate workloads, enhance resource utilization, and provide scalable and flexible
virtualization solutions.
Hardware at the Bottom: This is the actual physical machine:
• CPU
• Memory
• Storage
• Hyper-V runs directly on the hardware.
• It controls:
• CPU scheduling
• Memory allocation
• Hardware access
• It creates and manages virtual machines (VMs).
Root Partition (Parent OS): A special Windows OS that starts first.
• It has device drivers, VM management services
• It does not run user workloads.
• It manages all virtual machines.

16
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Child Partitions (Virtual Machines):


• Each VM runs inside a child partition.
• VM can be:
• Windows
• Linux
• Each VM runs:
• Guest OS
• User applications
• Cannot access hardware directly.
VMBus (Communication Channel):
• VMs talk to the root partition using VMBus.
• Ensures fast and secure communication.
• Avoids slow hardware emulation.
Hypercalls (Safe Requests)
When a VM needs:
CPU control
Memory access
I/O operations

17
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

• It sends a hypercall to the hypervisor.


• Hypervisor performs the task safely.
Advantages (Pros):
• High performance
• Strong security
• Enterprise-level virtualization
Disadvantages (Cons):
• Requires compatible hardware
• Best suited for Windows ecosystem

Introduction to Containerization:

VMs vs Containers:
Virtual machines and Containers are two ways of deploying multiple, isolated services on a
single platform.
Virtual Machine:
It runs on top of an emulating software called the hypervisor which sits between the hardware
and the virtual machine. The hypervisor is the key to enabling virtualization. It manages the
sharing of physical resources into virtual machines. Each virtual machine runs its guest
operating system. They are less agile and have lower portability than containers.
Container:
It sits on the top of a physical server and its host operating system. They share a common
operating system that requires care and feeding for bug fixes and patches. They are more agile
and have higher portability than virtual machines.

18
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Need for Containers:


• Containers virtualize only the application layer
• Share the host operating system kernel
• Run applications in isolated environments
• Lightweight and fast
• Efficient resource utilization
• Consistent behavior across systems
Containerization:
• Containerization is a software deployment technique
• It bundles Application code, Required libraries, and Dependencies
• The container runs consistently on any infrastructure
• Eliminates OS and environment compatibility issues
• One container can run on Windows, Linux, Cloud platforms
Benefits of Containerization:
1. Portability: Applications run consistently across different environments and operating
systems without code changes.
2. Scalability: Lightweight containers start quickly and can be easily scaled up or down
based on demand.
3. Fault Tolerance: Isolated containers ensure that failure of one component does not
affect the entire application.
4. Agility: Developers can quickly build, test, debug, and deploy applications without
impacting the host system.
Containerization Use Cases:
1. Cloud Migration: Legacy applications are containerized and moved to the cloud
without rewriting code (Lift and Shift).
2. Microservices Architecture: Applications are split into small, independent services,
each packaged and deployed using containers.
3. IoT Applications: Containers simplify deployment and updates on resource-limited
IoT devices, enabling the same application to run across multiple devices.
Containerization Architecture:
• Infrastructure Layer:
Runs on physical servers or cloud machines and provides CPU, memory, and storage
resources.
• Operating System Layer:
Usually Linux; manages system resources while containers share the same OS kernel.

19
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

• Container Engine:
Software that creates and manages containers, acts between the OS and containers,
and handles resource allocation and isolation (e.g., Docker Engine).

• Application & Dependencies:


Includes application code, libraries, and configuration files, allowing the application
to run independently of the host environment.

Differences between Virtual Machines (VM) and Containers:


SNo. Virtual Machines (VM) Containers
1 VM is a piece of software that allows you While a container is software that allows
to install other software inside of it so you different functionalities of an application
control it virtually as opposed to independently.
installing the software directly on the
computer.
2. Applications running on a VM system, or While applications running in a container
hypervisor, can run different OS. environment share a single OS.
3. VM virtualizes the computer system, While containers virtualize the operating
meaning its hardware. system, or the software only.
4. VM size is very large, generally in While the size of the container is very light,
gigabytes. generally a few hundred megabytes, though
it may vary as per use.
5. VM takes longer to run than containers, While containers take far less time to run.
the exact time depending on the
underlying hardware.
6. VM uses a lot of system memory. While containers require very less memory.
7. VM is more secure, as the underlying While containers are less secure, as the
hardware isn't shared between processes. virtualization is software-based, and
memory is shared.
8. VMs are useful when we require all of the While containers are useful when we are
OS resources to run various applications. required to maximize the running
applications using minimal servers.
9. Examples of Type 1 hypervisors are Examples of containers are RancherOS,
KVM, Xen, and VMware. Virtualbox is a PhotonOS, and Containers by Docker.
Type 2 hypervisor

20
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Docker Architecture:
• Docker is a containerization platform.
• It helps developers build, test, and deploy applications quickly.
• Docker packages an application into a container.
• A container includes Application code, Libraries, System tools, Runtime.
• It ensures “Build once, run anywhere”.
• Applications run the same on local system, cloud, any OS.

Docker follows a client-server architecture. The Docker client communicates with a


background process, the Docker Daemon, which does the heavy lifting of building, running,
and managing your containers. This communication happens over a REST API, typically via
UNIX sockets on Linux (e.g., /var/run/[Link]) or a network interface for remote
management.

1. The Docker Daemon (dockerd):


The Docker Daemon is the persistent background process that acts as the brain of your
Docker installation.
• It runs on the Docker Host.
• It listens for API requests from the Docker Client.
• It manages all Docker objects: images, containers, networks, and volumes.
• It can communicate with other daemons to manage Docker services in a multi-host
environment (like a Docker Swarm cluster).

2. The Docker Client:


The Docker Client is the primary interface through which users interact with Docker. This is
most commonly the Command Line Interface (CLI).
• It translates user commands like docker ps into REST API requests.
• These requests are sent to the Docker Daemon for processing.
• A single client can communicate with multiple daemons.

Common Commands:
• docker build: Builds an image from a Dockerfile.

21
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

• docker pull: Pulls an image from a registry.


• docker run: Creates and starts a container from an image.
Here, Dockerfile is a text file containing step-by-step instructions for creating an image,
such as installing dependencies, copying files, and configuring the environment.

3. The Docker Host


The Docker Host is the physical or virtual machine that provides the complete environment for
executing and running containers. It comprises:
• The Operating System (and its kernel).
• The Docker Daemon.
• Images that have been pulled or built.
• Running Containers.
• Networks and Storage components.

4. The Docker Registry


A Docker Registry is a stateless, scalable storage system for Docker images.
• Public Registry: The default public registry is Docker Hub, which contains a vast
collection of community and official images.
• Private Registries: Organizations often use private registries (like Harbor, AWS ECR, or
Google Artifact Registry) to store proprietary images for security and control.

Docker Image Lifecycle Commands:


1) docker pull <image_name>: Downloads an image from a configured registry to
your local Docker Host.
2) docker push <image_name>: Uploads a local image to a registry.

Container Images:
• A container image is a lightweight, stand-alone, executable package containing the
application code, runtime, libraries, environment variables, and configuration files
needed to run the application across various environments.
• A Container Image contains:
• Application code
• Runtime (e.g., Java, Python, [Link])
• System libraries
• Dependencies
• Configuration files
Container Image Architecture:
A container image is built using a layered architecture, where each layer adds specific
functionality.
All layers are read-only and immutable, making images lightweight and reusable.
1. Base OS Layer
• Minimal operating system
• Examples: Alpine Linux, Ubuntu
• Provides basic OS utilities

22
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

2. Runtime Layer
• Provides language runtime
• Examples:
• Java → JDK
• Python → Python Interpreter
• [Link] → Node Runtime
3. Dependency Layer
• Required libraries and frameworks
• Ensures application runs without dependency conflicts
4. Application Layer
• Contains application code
• Business logic and configuration files

Characteristics of Container Image Architecture:


• Layered and modular
• Immutable (read-only)
• Faster builds using cached layers
• Storage-efficient
• Portable across cloud platforms

Container images benefits:


• Ease of use: The container image format is designed to download quickly and start instantly.
• Reusability: Because a container image bundles an application and its dependencies, the app
does not need to be rebuilt for other environments.
• Lightweight: A running container generally consumes less compute and memory than a
comparable VM.

Container images drawbacks:


• Potential for fraudulent images: Organizations must monitor for fraudulent images and
train users on best practices when they pull from public container repositories.
• Container image sprawl: Organizations can end up with an accumulation of similar or
unused container images, which can lead to storage inefficiencies and potential security risks.
• Resource consumption: Stopped containers are not automatically removed and continue to
consume storage resources.

Container Registries:
• A container registry allows you to store, share, and manage container images in a
centralized location for easy distribution.
• Some registries are public, such as Docker Hub or Google Container Registry, where
anyone can upload and download images.
• Other registries are for private internal use.
• Private registries typically require authentication to access, so only authorized users can
upload or pull images. Private registries also control access based on user roles or
permissions.
• Registries are highly available and scalable, enabling developers to quickly retrieve the
needed images, even in a production environment with large-scale systems.
23
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Some common container registry options include the following:


1. Docker Hub: One of the most widely used public registries, hosting millions of official and
community-contributed container images. It allows developers to push and pull images to
and from the cloud.
2. Google Container Registry (GCR): A private registry provided by Google Cloud. It offers
tight integration with Google Cloud services and is ideal for users who want to store their
images within the Google Cloud ecosystem.
3. Amazon Elastic Container Registry (ECR): A managed container registry service
provided by AWS. It integrates with AWS services and provides scalability and security
features tailored for AWS users.

Types of Container Registries:


There are two types of container registries:
• Public registries feature ways to optimize data transfer and relaxed access control but lack
advanced security protocols.
• Private repositories are typically used in situations requiring safer operation and more
rigorous protection of workloads.

Advantages & Disadvantages of Docker:


Advantages:
1. Portability: Move apps across environments without breaking them
2. Fast Deployment & Scalability: Containers start in seconds
3. Resource-Efficient & Lightweight: Shares host OS, less overhead
4. Consistent Development & Testing: Same environment everywhere
5. Isolation & Security: Apps run in their own space
Disadvantages:
1. Not ideal for GUI-based applications
2. Persistent storage handling is complex
3. Limited support for some OS features
4. Learning curve for beginners
5. Security depends on proper configuration

Introduction to Kubernetes:
• Kubernetes or K8S is an open-source container management tool.
• Kubernetes helps in:
o Deploying applications
o Scaling them when users increase
o Keeping them running without failure
o Automating operations

24
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Kubernetes Features:
• Service Discovery & Load Balancing – Provides stable network access and distributes
traffic
• Storage Orchestration – Automatically connects containers to required storage
• Automated Rollouts & Rollbacks – Updates apps safely and restores previous version
if needed
• Automatic Bin Packing – Places containers efficiently based on CPU & memory
• Self-Healing – Restarts or replaces failed containers automatically
• Secret & Config Management – Securely manages passwords and app settings
• Batch Execution – Runs and manages background jobs
• Horizontal Scaling – Easily scale applications up or down
• Extensibility – Supports adding custom features and integrations
Kubernetes Architecture:
Kubernetes Cluster Architecture describes,
• What components it has, where they run, and what each one does.
• How Kubernetes is organized internally to run applications reliably.
• Kubernetes cluster consist of nodes, which can be physical or virtual machines.
• There are two primary types of nodes in Kubernetes:
o Worker Nodes and
o Master Node
• Master Nodes: These are responsible for controlling and managing the Kubernetes cluster,
including the scheduling of pods and maintaining the desired state of the system.
• Worker Nodes: These are the machines where the actual work is done. They run the
applications (in the form of containers) inside pods.

25
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Master Node Processes:


The master node is responsible for managing and controlling the Kubernetes cluster.
1. API Server (Cluster Gateway):
The API server is the entry point for all interactions with the Kubernetes cluster. It validates
and processes requests from users or other components, acting as the gateway for the entire
system.
2. Scheduler:
The scheduler’s job is to decide where the pods should run. Based on available resources and
constraints, it assigns pods to specific worker nodes.
3. Controller Manager:
The controller manager is responsible for monitoring the state of the cluster. For example, if a
pod goes down, the controller manager will automatically schedule a new pod to replace it.
4. ETCD:
ETCD is the key-value store that holds the entire state of the Kubernetes cluster. It stores
configuration data and the state of all resources, such as pods, nodes, and services.

Worker Node Processes:


A worker node is responsible for running the containers that make up your application.
1. Container Runtime:
The container runtime is the software responsible for running containers on the node. It pulls
container images, starts containers, and stops them.
Example: Docker’s Engine
2. Kubelet:
The Kubelet is an agent that runs on each worker node in the cluster. It ensures that containers
are running in the pods.
3. Kube Proxy:
Kube Proxy is responsible for managing network traffic and ensuring that requests are
forwarded to the appropriate container within the pod.

Kubernetes Pods:
In the following diagram, you can see cube-like structures they are called containers. Each of
the containers will have one application. The cylinder-like structure is called volume, where
the data of the containers will be stored and the circles are called pods.

26
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

A Pod can contain one or more containers, and all containers inside a Pod share:
• The same IP address
• Storage volumes
• Network resources
• Other required configurations

Pods allow easy movement of containers within a cluster. They are created and managed
by controllers, which handle:
• Rollouts (new versions of Pods)
• Replication (keeping the right number of Pods running)
• Health monitoring (restarting or replacing failed Pods)

Kubernetes Deployment
A Kubernetes Deployment is a high-level resource used to manage and scale applications while
ensuring they remain in the desired state. It provides a declarative way to define how many
Pods should run, which container images they should use, and how updates should be
applied.

With a Deployment, we can:


• Scale applications up or down based on demand.
• Maintain reliability, ensuring the desired number of Pods are always running and healthy.
• Perform rolling updates to introduce new versions without downtime.
• Rollback easily if an update causes issues.

A Kubernetes Deployment managed ReplicaSet. Each one represents a different version of the
deployed application. Each ReplicaSet manages a set of identically versioned Pods.

27
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Use Cases of Kubernetes Deployments:


Kubernetes Deployments are widely used to manage application lifecycles in a cluster. Typical
use cases include:
• Rolling out new applications: Create a Deployment that launches a ReplicaSet, which in
turn provisions Pods in the background. You can monitor the rollout status to verify success.
• Updating applications seamlessly: Modify the PodTemplateSpec in a Deployment to
trigger a new ReplicaSet. The Deployment gradually scales the new ReplicaSet up while
scaling the old one down, replacing Pods at a controlled pace. Each update increments the
Deployment’s revision.
• Rolling back safely: Revert to a previous Deployment revision if the current rollout fails
or becomes unstable. Each rollback generates a new revision.
• Scaling with demand: Increase or decrease replicas in a Deployment to handle varying
traffic loads.
• Pausing and resuming rollouts: Temporarily pause a Deployment to apply multiple fixes
to the Pod template, then resume it to roll out all changes at once.
• Monitoring rollout status: Use the Deployment’s status field to detect if a rollout is
progressing or stuck.
• Cleaning up resources: Remove outdated ReplicaSets that are no longer needed to keep
the cluster tidy and efficient.

Kubernetes Service:
• A Kubernetes Service provides a stable network endpoint to access a group of Pods.
Since Pods are temporary and their IP addresses change whenever they restart or are
replaced, connecting directly to Pod IPs is unreliable.
• A Service solves this problem by offering a permanent IP address and DNS name that
remain the same even when the underlying Pods change. It also distributes traffic
automatically among available Pods.
• Instead of communicating with individual Pod IPs, applications connect to the
Service, which ensures stable and reliable communication.

28
CSE Department, KLEF, Bachupally Campus Y24 Regulation II Year-Even Sem.

Types of Service:
When we define a service configuration, we can specify the type of the service, the type
attribute can have four different values:
1. ClusterIP
2. Headless Service
3. NodePort
4. Load Balancer
1. ClusterIP Service
• ClusterIP is the most common Service as well as it is the Default type of Service,
meaning when you create a Service and not specify a type it will automatically take
ClusterIP as a type.
2. Headless Service
• Headless Service is a type of Service that allows the client to directly communicate
with the Pods.
• It is a useful tool for building distributed applications.
• Headless Services are used in deploying Stateful Application in Kubernetes.
3. NodePort
• NodePort is a Service that is accessible on a static Port on each Worker Node in the
cluster.
• The NodePort Service makes the external traffic accessible on static or fixed port on
each worker Node which is different from the ClusterIP Service which was only
accessible within the Cluster.
4. Load Balancer
• Load Balancer Service type allows the Service to become accessible externally through
a Cloud Provider's Load Balancer functionality.
• Load Balancer Service is an extension of NodePort Service.

29

You might also like