Virtualization
Virtualization
• The virtualization layer partitions the physical resources into multiple virtual
machines
• Virtualization technology is a key component of cloud computing, particularly for
infrastructure-based services.
• It enables the creation of secure, customizable, and isolated execution
environments for running applications, even untrusted ones, without impacting
others.
• This is achieved through the ability of software and hardware to emulate a
separate execution environment, such as running Windows OS on a virtual
machine hosted on Linux OS.
• Virtualization supports the development of elastically scalable systems, allowing
for cost-effective, on-demand provisioning of additional capabilities.
• Virtualization is a large umbrella of technologies and concepts that are meant to
provide an abstract environment—whether virtual hardware or an operating
system—to run applications.
• Computers today are so powerful that in most cases only a fraction of their
capacity is used by an application or the system.
• The continuous need for additional capacity, whether this is storage or compute
power, makes data centers grow quickly.
• Companies like Google and Microsoft expand their infrastructure by building data
centers, as large as football fields, that are able to host thousands of nodes.
Rise of Administrative Costs.
• Power consumption and cooling costs have now become higher than the cost of
the IT equipment. Moreover, the increased demand for additional capacity, which
translates into more servers in a data center, is also responsible for a significant
increment in the administrative costs.
• These are labor-intensive operations, and the higher the number of servers that
have to be managed, the higher the administrative costs.
• Virtualization can help in reducing the number of required servers for a given
workload, thus reducing the cost of the administrative personnel.
Greening Initiatives.
• Recently, companies are increasingly looking for ways to reduce the amount of
energy they consume and to reduce their carbon footprint.
• Data centers are one of the major power consumers and contribute consistently to
the impact that a company has on the environment.
• Maintaining a data center operational does not only involve keeping servers on,
but a lot of energy is also consumed for keeping them cool
Components of Virtualized Environment
• In a virtualized environment, there are three major components: guest, host, and
virtualization layer,
• The guest represents the system component that interacts with the
virtualization layer
• The host represents the original environment where the guest is supposed to be
managed.
• The virtualization layer is responsible for recreating the same or a different
environment where the guest will operate.
• Characteristics of Virtualized Environments
• Increased Security
• Managed Execution
• Sharing
• Aggregation
• Emulation
• Isolation
• Portability
Increased Security
• Virtual machines act as intermediaries, translating guest operations to the host.
• This setup enhances control and security by allowing the virtual machine manager
to filter guest activities, preventing harmful actions.
• It also ensures host resources and sensitive information are protected without
complex security policies.
• Aggregation: A group of separate hosts can be tied together and represented to guests as a single virtual
host.
• Isolation: Allowing multiple guests to run separately on the same host without interference
while protecting the host from harmful guest operations.
• Additionally, it supports performance tuning, resource control, and features like virtual machine
migration, enhancing efficiency and service quality in data centers.
• Portability in virtualization enables virtual images to be moved and executed across
different virtual machines, provided the specific virtual machine manager is available.
• This flexibility ensures users can carry and use their systems anywhere, as long as the
required virtual machine manager is present.
Taxonomy of Virtualization Techniques
• These techniques are grouped based on how they abstract, emulate, or virtualize physical
resources, enabling the creation of virtual environments.
• Virtualization is classified based on the service or entity being emulated, focusing on
execution environments, storage, and networks.
• Execution virtualization, the most developed category, is further divided into two types:
Process-level techniques, which run on an existing operating system, and System-level
techniques, which run directly on hardware with minimal OS support.
• These techniques offer varying levels of virtual environments, such as bare hardware, OS
resources, programming languages, or application libraries.
• Process-level virtualization is a lightweight form of virtualization that isolates
processes within a single operating system environment. It allows multiple
isolated applications or tasks (often referred to as containers) to run as though
they are separate systems
• Programming-Level Virtualization:
• Abstracts runtime environments for applications.
• Examples: JVM (Java Virtual Machine), .NET CLR.
• Process-Level Virtualization:
• Virtualizes individual processes.
• Example: Chroot.
Execution Virtualization
• The Machine Reference Model provides a structured framework for understanding the
virtualization of computing environments across different layers of the computing stack.
• This model defines the interfaces and abstraction layers
• Key components include
• Instruction Set Architecture (ISA)
• Application Binary Interface (ABI)
• Application Programming Interface (API)
• Security and Privilege Levels
• Execution Modes
• Hypervisor
Instruction Set Architecture (ISA):
• The lowest layer defines hardware interaction, including processor instructions,
registers, memory, and interrupts.
• ISA is essential for OS developers (System ISA) and application developers (User
ISA).
Application Binary Interface (ABI):
• ABI separates the operating system from applications and libraries.
• It includes details like low-level data types, alignment, and system call formats,
ensuring application portability across OS implementations with the same ABI.
Application Programming Interface (API):
• Represents the highest level of abstraction, linking applications with libraries and
the OS.
• Operations initiated at the API level rely on ABI and ISA to translate high-level
instructions into machine-level operations.
Security and Privilege Levels:
• The model divides machine instructions into privileged and non-privileged
categories.
• Privileged instructions handle sensitive operations, while non-privileged ones
perform tasks without accessing shared resources.
• Modern systems implement a ring-based security model, with Ring 0 (most
privileged) for the OS kernel and Ring 3 (least privileged) for user applications.
Execution Modes:
• Supervisor (Kernel) Mode: All instructions, including privileged ones, can be
executed without restrictions, primarily by the OS or hypervisor.
• User Mode: Access to machine-level resources is restricted. Attempts to execute
privileged instructions trigger hardware interrupts.
Role of the Hypervisor:
• Operates conceptually above the supervisor mode to manage multiple virtual
environments.
• Early ISAs allowed certain sensitive instructions to run in user mode, posing
virtualization challenges. Modern ISAs (e.g., Intel VT and AMD Pacifica) have
resolved these by enforcing privileged execution for all sensitive instructions.
Hardware-Level Virtualization
Hardware-level virtualization is a technique that creates an abstract execution
environment mimicking physical hardware, enabling guest operating systems to run
on it.
Key components include:
This approach enables efficient resource utilization and isolation between multiple
operating systems on the same hardware.
Hypervisors are central to hardware virtualization, acting as Virtual Machine Managers
(VMM) to create and manage virtual hardware environments where guest operating
systems can run.
Types of Hypervisors
• Type I (Native Hypervisors):
• Run directly on physical hardware, replacing the operating system.
• Interact with the hardware's Instruction Set Architecture (ISA) interface to manage
guest operating systems.
• Example: VMware ESXi, Microsoft Hyper-V.
• Type II (Hosted Hypervisors):
• Operate as applications within an existing operating system.
• Use the Application Binary Interface (ABI) of the host OS to emulate the ISA for
guest operating systems.
• Example: VMware Workstation, Oracle VirtualBox.
Key Components of a Hypervisor
• Dispatcher: Entry point for the virtual machine, rerouting its instructions to the
appropriate module.
• Allocator: Manages system resources allocated to the VM and adjusts them as
needed.
• Interpreter: Executes routines for privileged instructions by triggering traps when
such instructions are executed.
Requirements for Effective Virtualization
Theorem 1:
• Evolution: This technique evolved from the chroot mechanism in Unix, which isolates
processes by changing their root directory.
• Efficiency: Unlike hardware virtualization, this method imposes minimal overhead since
applications directly use system calls without emulation or modification.
• Limitations: All user space instances share the same OS, reducing flexibility compared to
hardware virtualization.
• NET framework
• The Java virtual machine was originally designed for the execution of
programs written in the Java language but other languages such as Python,
Pascal, Groovy, and Ruby were made available
Key Concepts:
• Isolation: Applications are encapsulated in a virtual container, which includes the
application files, settings, libraries, and dependencies. This container is isolated from the
underlying OS and other applications, preventing conflicts and ensuring a consistent
runtime environment.
• Portability: Virtualized applications can be easily moved and run on different operating
systems and hardware without modification. This is because the virtualization layer
abstracts the hardware and OS specifics.
• Ease of Deployment: Applications can be deployed more efficiently as they do not
require installation in the traditional sense. Users can run the virtualized applications
directly from the container.
• Simplified Management: It simplifies application updates, patches, and maintenance as
the changes can be made to the virtual container without affecting the host OS or other
applications.
Other Types of Virtualization
• Storage Virtualization
• Network virtualization
• Desktop virtualization
• Application-server virtualization
Storage Virtualization:
• This technique consolidates various storage facilities under a single logical file system.
• Storage Area Networks (SANs), which provide storage access over a high-bandwidth
network connection.
Network Virtualization
• It involves using hardware and software to create and manage virtual networks.
• It can either combine multiple physical networks into a single logical network
(external network virtualization) or provide network-like functionality within an
operating system partition.
Network virtualization can take two forms:
• Abstracts multiple application servers into a single virtual server using load
balancing and high availability strategies.
• It offers benefits like on-demand IT infrastructure and services but also comes
with drawbacks.
Advantages
• The key advantages of virtualization include managed execution and isolation, which
enhance security and control by creating secure, sandboxed environments.
• Portability is another benefit, as virtual machine instances can be easily moved and are
self-contained, simplifying administration and reducing maintenance costs.
• Virtualization also enables efficient resource usage, allowing multiple systems to share
underlying host resources securely, supporting dynamic adjustment of physical resources
to save energy and reduce environmental impact.
Disadvantages
• However, advancements like paravirtualization and native code compilation have helped
mitigate these issues.
Inefficiency and Degraded User Experience
• Virtualization can lead to inefficient host usage and degraded user experiences due
to limited access to specific host features.
• In hardware virtualization, device drivers may only provide default features,
restricting access to advanced host capabilities.
• In programming-level virtual machines, some OS features may be inaccessible
without special libraries.
• Security Holes and New Threats
• Virtualization introduces new security risks, such as advanced phishing attacks and
malware like BluePill and SubVirt, which exploit the ability to emulate hosts
transparently.
• These malicious programs can preload themselves before the OS, acting as virtual
machine managers to extract sensitive information.
• The rise of such threats is partly due to hardware initially not being designed for
virtualization.
Containers and Container Orchestration
Simplifying Application Deployment and Management
Definition
• Containers ensure that the application runs consistently across different computing
environments, from development to testing and production.
Key Features of Containers
• Isolation: Applications in containers run independently from the host system and
other containers.
• Portability: Containers can run on any platform that supports container runtimes
like Docker.
• Efficiency: Containers use shared resources of the host OS, making them more
lightweight compared to virtual machines.
• Consistency: Containers ensure that the application runs in the same environment
regardless of where it is deployed. This eliminates the risk of any unexpected
behavior due to environmental differences.
• Fast deployment: Containers enable fast deployment of applications, as they can
be easily created, started, and stopped within seconds.
Example: Packaging a Python Application
•Imagine you’re developing a Python web app that requires:
•Python 3.10
•Flask library
•A specific configuration file (config.json).
• Without containers, you might face challenges like dependency conflicts or
runtime mismatches when deploying the app to different machines.
• With containers, this process becomes seamless.
Difference between Virtual Machines and containers.
VMs occupy more space in gigabytes Containers do not take much disk space.
in the disk. They take space in megabytes.
Step 1: Write a Dockerfile: The Dockerfile defines the environment for the application.
With Containers:
•A single Docker image contains everything needed for the app to run.
•The container can run anywhere with Docker installed.
Improved resource utilization:
• Containers are more lightweight than virtual machines, as they do not require a
full operating system for each container.
• This means that you can run more containers on a single physical or virtual
machine, which can improve resource utilization and reduce costs.
• Container orchestration tools, such as Kubernetes, make it easy to deploy and manage
containerized applications at scale.
• These tools provide features such as automatic scaling, rolling updates, and self-healing,
which can make it easier to scale applications up or down as needed.
Enhanced security:
• Containers provide an additional layer of security, as they isolate applications from each other
and from the host operating system.
• This can help to reduce the risk of vulnerabilities or attacks that may impact multiple
applications or the underlying infrastructure.
Key components and concepts related to containerization in cloud
computing
• Containers: These are lightweight, portable, and executable software packages that
contain everything needed to run an application, including code, runtime, system
tools, libraries, and settings.
• Docker: Docker is a popular platform for containerization that simplifies the
creation, deployment, and management of containers.
• It provides tools and a runtime environment to build and run containers efficiently.
• Container Orchestration: Container orchestration tools, such as Kubernetes,
Docker Swarm, and Amazon ECS, manage the deployment, scaling, and automation
of containerized applications across a cluster of machines or cloud instances.
• Portability and Consistency: Containers ensure consistent performance and
behavior across various environments, allowing developers to build applications that
can run seamlessly on different cloud platforms or on-premises infrastructure.
• Resource Efficiency: Containers share the host operating system’s kernel,
enabling them to use resources more efficiently than traditional virtual machines
(VMs). They start up faster and consume fewer resources, leading to better
resource utilization.
• Microservices Architecture: Containerization facilitates the adoption of
microservices architecture by allowing applications to be broken down into
smaller, loosely coupled services, each running in its own container.
• DevOps Practices: Containers play a significant role in DevOps workflows,
enabling continuous integration and continuous deployment (CI/CD) pipelines.
• Isolation and Security: Containers use mechanisms like namespaces and control
groups to provide isolation between applications running on the same host.
However, proper security practices and measures are essential to mitigate potential
risks.
Container Services in Cloud Platforms
1.Amazon Web Services (AWS):
o Amazon ECS: Elastic Container Service.
o Amazon EKS: Elastic Kubernetes Service.
o AWS Fargate: Serverless container hosting.
2.Google Cloud:
o Google Kubernetes Engine (GKE): Managed Kubernetes service.
o Cloud Run: Serverless container execution.
3.Microsoft Azure:
o Azure Kubernetes Service (AKS).
o Azure Container Instances (ACI): For lightweight containers.
Container Orchestration
• A software platform that automates the deployment, management and scaling, etc.
of the containers is called a Container Orchestration.
Popular Tools:
• Kubernetes
• Docker Swarm
• Apache Mesos
Why Container Management?
Key Functions:
• Containers are isolated from one another and bundle their own software, libraries, and
configuration files; they can communicate with each other through well-defined
channels.
• We can run the docker image as a docker container in any machine where docker is
installed without depending on the operating system.
Key Features:
• Docker Engine: It is a core part of docker, that handles the creation and
management of containers.
• Docker Image: It is a read-only template that is used for creating containers,
containing the application code and dependencies.
• Docker Hub: It is a cloud based repository that is used for finding and sharing the
container images.
• Docker file: It is a script that containing instructions to build a docker image.
• Docker Registry : It is a storage distribution system for docker images, where you
can store the images in both public and private modes.
Fast, Consistent Delivery of Applications
• Docker streamlines the development lifecycle
• Containers are great for continuous integration and continuous delivery (CI/CD)
workflows.
• Consider the following example scenario:
• Developers write code locally and share their work with their colleagues using
Docker containers.
• They use Docker to push their applications into a test environment and run
automated and manual tests.
• When developers find bugs, they can fix them in the development environment
and redeploy them to the test environment for testing and validation.
• When testing is complete, getting the fix to the customer is as simple as
pushing the updated image to the production environment.
Docker Architecture
• The Docker client talks to the Docker daemon, which does the heavy lifting of
building, running, and distributing your Docker containers.
• The Docker client and daemon can run on the same system, or you can connect a
Docker client to a remote Docker daemon.
• The Docker client and daemon communicate using a REST API, over UNIX
sockets or a network interface.
• The Docker Engine is the heart of the Docker platform. It comprises two main
components:
• Docker Daemon (dockerd): The Docker daemon runs on the host machine and is
responsible for managing Docker objects, such as images, containers, networks,
and volumes.
• Docker Client: The Docker client is a command-line interface (CLI) tool that
allows users to interact with the Docker daemon through commands. Users can
build, run, stop, and manage Docker containers using the Docker CLI.
Docker Images:
• Docker images are the building blocks of containers.
• They are read-only templates that contain the application code, runtime, system
tools, libraries, and other dependencies.
• Docker images are created from Dockerfiles, which are text files containing
instructions for building the image layer by layer.
Docker Containers:
• Docker containers are runnable instances of Docker images.
• They encapsulate the application and its dependencies, providing an isolated
environment for execution.
• Containers can be created, started, stopped, moved, and deleted using Docker
commands.
Docker Registry:
• Docker Registry is a centralized repository for storing and sharing Docker images.
• The default public registry is Docker Hub, where users can find a vast collection
of images.
• Organizations can also set up private registries to store proprietary images
securely.
• With the help of docker run or docker pull commands, we can pull the required
images from our configured registry.
• Images are pushed into configured registry with the help of the docker
push command.
Docker Compose:
• Docker Compose is a tool for defining and running multi-container Docker
applications.
• Docker volumes are used for persisting data generated by and used by Docker
containers.
• They provide a way for containers to store and share data independently of the
container lifecycle, ensuring data persistence and portability.
Docker Networking:
Why Kubernetes?
Components:
● Kube-apiserver
● Etcd
● Kube-controller-manager
● Cloud-controller-manager
● Kube-scheduler
Master Node Components
• It acts as a bridge, enabling Kubernetes to understand and work with the resources
and services offered by different cloud platforms.
• The pod starts in a "Pending" state because it hasn't been assigned to any node
yet.
• The Kube Scheduler looks at the available nodes and decides which one is the
best fit for that pod.
• Once the decision is made, the pod is assigned to the selected node, and the
Kubelet on that node takes over to run the pod.
Example:
• Imagine Kubernetes is like a delivery company:
• Pods are packages that need to be delivered.
• Nodes are delivery trucks.
• The Kube Scheduler is the dispatcher who decides which truck should carry each
package based on things like the truck’s available space, location, and current
load.
• The Kube-proxy is a key networking component in Kubernetes that helps
manage how network traffic is routed to different services and pods within the
cluster.
● Kubelet
● Kube-proxy
● Container runtime engine
Worker Node Components
• Example: If the API server tells the kubelet to run 3 pods, the kubelet makes sure
exactly 3 pods are running on that node.
Kube-proxy:
• Example: If a pod runs an NGINX web server, the container runtime starts and
manages that NGINX container.
Pods, Services, and Deployments
• Docker Containers
• CRI-O
• Mirantis Container Runtime
• Terraform is an open-source Infrastructure as Code (IaC) tool developed by
HashiCorp.
• Cloud providers:
• Amazon Web Services (AWS),
• Microsoft Azure,
• Google Cloud Platform (GCP)
On-premises infrastructure:
Servers, virtual machines, and other hardware located in your own data centers.
1.Write:
•Create a .tf file describing the infrastructure (e.g., servers, databases, networks).
2.Init:
•Run terraform init to initialize Terraform and download necessary plugins.
3.Plan:
•Run terraform plan to preview the changes that will be made.
4.Apply:
•Run terraform apply to apply the changes and create/update infrastructure.
5.Destroy:
•Run terraform destroy to remove the infrastructure when it's no longer needed.
Key Components
• Terraform Core
• Terraform Providers
• Terraform Configuration Files (.tf)
• Terraform State File (terraform.tfstate)
• Command-Line Interface (CLI)
• Terraform Backend
Terraform Core:
•Responsibilities:
• Act as plugins that allow Terraform to interact with external systems like AWS,
• Written in HCL, these files define the desired state of the infrastructure.
• Includes resource definitions, variables, outputs, and modules to structure complex
setups.
Terraform State File (terraform.tfstate):
terraform init, plan, apply, and destroy to manage the infrastructure lifecycle.