Module 3 - Virtualization - VM Containers
Module 3 - Virtualization - VM Containers
Virtualization
Virtual Machines and Containers
Module 3
Sheheryar Malik, Ph.D.
Virtualization
• In computing, virtualization is simulating a hardware platform,
operating system (OS), storage device, or network resources
• The term "virtualization" traces its roots to 1960s mainframes
o during which it was a method of logically dividing the mainframes' resources
for different applications
• Virtualization allows one computer to do the job of multiple
computers
o Virtual environments let one computer host multiple operating systems at the
same time
1
9/13/2024
Virtualization
• Virtualization is way to run multiple operating systems and user
applications on the same hardware
o E.g., run both Windows and Linux on the same laptop
• How is it different from dual-boot?
o Both Operating Systems run simultaneously
• The Operating Systems are completely isolated from each other
Virtualization
Virtual Virtual
Container Container
Hardware Hardware
2
9/13/2024
Virtualization
Uses of Virtualization
3
9/13/2024
Hypervisor
4
9/13/2024
Hypervisor
• In computing, a hypervisor is a virtualization platform that allows
multiple operating systems to run on a host computer at the same
time
• Also called Virtual Machine Monitor
Types of Hypervisor
10
5
9/13/2024
Guest OS 1 OS 2 OS 3 OS 4
Virtualization Platform
Host
Hardware
11
Guest OS 1 OS 2 OS 3
Hardware
12
6
9/13/2024
VMware Products
• VMware Workstation Pro
o First product launched by VMware in 1999
o It allows users to run multiple instances of x86 or x86-64 compatible operating systems on a single
physical PC
• VMware Workstation Player
o It is for users without a license (for non-commercial use) to use VMware Workstation or VMware
Fusion
• VMware Fusion
o It provides similar functionality for users of the Intel Mac platform, along with full compatibility
with virtual machines created by other VMware products
• VMware vSphere
o It is an enterprise-level product, can deliver greater performance than the freeware VMware
Server, due to lower system overhead
o It is also called "ESXi"
o VMware ESXi, as a "bare-metal" product, runs directly on the server hardware, allowing virtual
servers to also use hardware more or less directly
o In addition, VMware ESXi integrates into VMware vCenter, which offers extra services to enhance
the reliability and manageability of a server deployment
13
Types of Virtualizations
14
7
9/13/2024
Desktop Virtualization
• It is a software technology that separates the desktop environment and
associated application software from the physical client device that is used
to access it
• It may allow all the components of the desktop to be virtualized
o which allows for a highly flexible and much more secure desktop delivery model
• It supports a more complete desktop disaster recovery strategy as all
components are essentially saved in the data center and backed up
through traditional redundant maintenance systems
• If a user's device or hardware is lost, then
o the restore is much more straightforward and simpler, as all the components will be
present at login from another device
o there is much less chance that any critical data cannot be retrieved and
compromised, because no data is saved to the user's device
15
16
8
9/13/2024
Software Virtualization
• Operating system-level virtualization
o hosting of multiple virtualized environments within a single OS instance
• Application virtualization
o It is a software technology that encapsulates application software from the
underlying operating system on which it is executed
o It is the hosting of individual applications in an environment separated from
the underlying OS
o Application virtualization is closely associated with the concept of portable
applications
17
Memory Virtualization
• Memory virtualization
o aggregating random-access memory (RAM) resources from networked systems into a single
memory pool
• Virtual memory
o giving an application program the impression that it has contiguous working memory,
isolating it from the underlying physical memory implementation
Physical memory
Virtual Each application sees its own logical
Memory memory, independent of physical memory
App
App
Benefits of Virtual Memory
Swap space
•Remove physical-memory limits App
•Run multiple applications at once
Virtualization Sheheryar Malik, Ph.D. 18
18
9
9/13/2024
Storage Virtualization
• Storage virtualization
o the process of completely abstracting logical storage from physical storage
• Distributed file system
o any file system that allows access to files from multiple hosts sharing via a computer
network
• Virtual file system
o an abstraction layer on top of a more concrete file system, allowing client
applications to access different types of concrete file systems in a uniform way
• Storage hypervisor
o the software that manages storage virtualization and combines physical storage
resources into one or more flexible pools of logical storage
• Virtual disk drive
o a computer program the emulates a disk drive such as a hard disk drive or optical
disk drive
Virtualization Sheheryar Malik, Ph.D. 19
19
20
10
9/13/2024
Data Virtualization
• Data virtualization
o the presentation of data as an abstract layer, independent of underlying
database systems, structures and storage
• Database virtualization
o the decoupling of the database layer, which lies between the storage and
application layers within the application stack over all
21
Network Virtualization
• Network virtualization
o creation of a virtualized network addressing space within or across network subnets
• Virtual private network (VPN)
o a network protocol that replaces the actual wire or other physical media in a network with an
abstract layer, allowing a network to be created over the Internet
22
11
9/13/2024
x86 Virtualization
23
24
12
9/13/2024
Virtual
… Virtual VM
… VM
Machine Machine Virtual
Machine
… Virtual
Machine
Dynamic Translation Hypervisor
Hypervisor
Operating System
Virtualization Logic
25
Full Virtualization
• 1st Generation offering of x86/x64 server
virtualization
Virtual Machine
App. B
App. C
App. A
Guest OS
Hardware
Virtualization Sheheryar Malik, Ph.D. 26
26
13
9/13/2024
Full Virtualization
• Advantages
o The emulation layer
▪ Isolates VMs from the host OS and from each other
▪ Controls individual VM access to system resources, preventing an unstable VM from
impacting system performance
o Total VM portability
▪ By emulating a consistent set of system hardware, VMs have the ability to transparently move
between hosts with dissimilar hardware without any problems
• It is possible to run an operating system that was developed for another architecture on your own
architecture
• A VM running on a Dell server can be relocated to a Hewlett-Packard server
• Disadvantages
o Hardware emulation comes with a performance price
o In traditional x86 architectures, OS kernels expect to run privileged code in Ring 0
▪ However, because Ring 0 is controlled by the host OS, VMs are forced to execute at Ring 1/3,
which requires the VMM to trap and emulate instructions
o Due to these performance limitations, paravirtualization and hardware-assisted
virtualization were developed
Virtualization Sheheryar Malik, Ph.D. 27
27
Para-Virtualization
• Hardware environment is not fully simulated
Virtual Machine
App. B
App. C
App. A
Guest OS
28
14
9/13/2024
Para-Virtualization Approaches
• Recompiling the OS kernel
o Paravirtualization drivers and APIs must reside in the guest operating system kernel
o You do need a modified operating system that includes this specific API, requiring a
compiling operating systems to be virtualization aware
▪ Some vendors (such as Novell) have embraced paravirtualization and have provided
paravirtualized OS builds, while other vendors (such as Microsoft) have not
• Installing paravirtualized drivers
o In some operating systems it is not possible to use complete paravirtualization, as it
requires a specialized version of the operating system
o To ensure good performance in such environments, paravirtualization can be applied
for individual devices
o For example, the instructions generated by network boards or graphical interface
cards can be modified before they leave the virtualized machine by using
paravirtualized drivers
Virtualization Sheheryar Malik, Ph.D. 29
29
Hardware-assisted Virtualization
• The guest OS runs at ring 0
Virtual Machine
App. B
App. C
App. A
Guest OS
30
15
9/13/2024
Hardware-assisted Virtualization
• Pros
o It allows to run unmodified Operating systems (so legacy OS can be run
without problems)
• Cons
o Speed and Flexibility
▪ An unmodified OS does not know it is running in a virtualized environment and so, it
can’t take advantage of any of the virtualization features
• It can be resolved using paravirtualization partially
31
32
16
9/13/2024
Containerization
OS Level Virtualization
33
Containers
34
17
9/13/2024
Virtualization
• Virtualization is a collection of software technologies that enable
software applications to run on virtual hardware
o Virtual hardware (virtualization via virtual machines and hypervisor), or
o virtual operating systems (virtualization via containers)
35
36
18
9/13/2024
Containers
• Containers offer a logical packaging mechanism in which applications
can be abstracted from the environment in which they actually run
o 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
o 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
37
38
19
9/13/2024
Container Runtime
Virtualization Containerization
39
40
20
9/13/2024
Containers Benefit
• Fast Provision (in seconds / milliseconds)
• Near bare metal runtime performance
• VM-like agility – it’s still “virtualization”
• Flexibility
o Containerize a “system”
o Containerize “application(s)”
• Lightweight
o Just enough Operating System (JeOS)
o Minimal per container penalty
• Open source – free – lower TCO
• Growing in popularity
Virtualization Sheheryar Malik, Ph.D. 41
41
Containers Benefit
• Agile application creation and deployment
o increased ease and efficiency of container image creation compared to VM
image use
• Continuous development, integration, and deployment
o provides for reliable and frequent container image build and deployment with
quick and easy rollbacks (due to image immutability)
• Dev and Ops separation of concerns
o create application container images at build/release time rather than
deployment time, thereby decoupling applications from infrastructure
• Environmental consistency across development, testing, and
production
o Runs the same on a laptop as it does in the cloud
42
21
9/13/2024
Containers Benefit
• Cloud and OS distribution portability
o Runs on Ubuntu, RHEL, CoreOS, on-premises, on major public clouds, and anywhere
else
• Application-centric management
o Raises the level of abstraction from running an OS on virtual hardware to running an
application on an OS using logical resources
• Loosely coupled, distributed, elastic, liberated micro-services
o applications are broken into smaller, independent pieces and can be deployed and
managed dynamically – not a monolithic stack running on one big single-purpose
machine
• Resource isolation
o predictable application performance
• Resource utilization
o high efficiency and density
Virtualization Sheheryar Malik, Ph.D. 43
43
Containerization Layers
Layer 6
Development Workflow OpenShift, Cloud Foundry, Docker Cloud, Deis, Apcera, Apprenda
Opinionated Containers
Layer 5
Orchestration / Scheduling Kubernetes, Docker Swarm, Marathon/Mesos, Nomad, Diego
Service Model
Layer 4 Container Engine Docker, rkt, runC (OCI), Osv, LXC, LXD
44
22
9/13/2024
Containerization Layers
Serverless
PaaS
Swarm/
Container Orchestration
Swarm Mode
Container Engine
45
Container
• Like a normal Linux program, containers really have two states – rest and running
• Container Image / Repository
o a container is a file (or set of files) that is saved on disk
o This is referred to as a Container Image or Container Repository
• Once running, Containers are just process
o Typing command to start a container, the Container Engine unpacks the required files and meta-data, then
hands them off to the Linux kernel
• Starting a container is very similar to starting a normal process and requires making an API call to
the kernel
o This API call typically initiates extra isolation and mounts a copy of the files that were in the container image
• Containers have existed within operating systems for quite a long time
o A container is the runtime instantiation of a Container Image
o A container is a standard Linux process typically created through a clone() system call instead of fork() or
exec()
o Also, containers are often isolated further through the use of cgroups, SELinux or AppArmo
• There are several competing Container Image formats (Docker, Appc, LXD)
o These Container Engines take a Container Image and turn it into a Container (aka running processes)
46
23
9/13/2024
Container Image
• A container image, in its simplest definition, is a file which is pulled down
from a Registry Server and used locally as a mount point when starting
Containers
• Docker, RKT, and LXD, operate on the concept of pulling remote files and
running them as a Container
o Each of these technologies treats container images in different ways
▪ LXD pulls a single container image (single layer), while
▪ Docker and RKT use OCI-based images which can be made up of multiple layers
• Technically, it is much more complicated than a single file on a Registry Server
o The term “container image,” often means to imply Repository and referring to a
bundle of multiple container Image Layers as well as metadata which provides extra
information about the layers
• Historically, each Container Engine had its container images format
• Now major tools and engines have moved to a format defined by the Open
Container Initiative (OCI)
47
Container Engine
• A container engine is a managed environment for deploying
containerized applications
• It accepts user requests, including command line options, pulls
images, and from the end user’s perspective runs the container
• The container engine
o allocates cores and memory to containers
o enforces spatial isolation and security, and
o provides scalability by enabling the addition of containers
48
24
9/13/2024
Container Engine
• Most container engines don’t actually run the containers, they rely on
an OCI compliant runtime like runc
• There are many container engines, including docker, RKT, CRI-O, and
LXD
o Many cloud providers, Platforms as a Service (PaaS), and Container Platforms
have their own built-in container engines
▪ which consume Docker or OCI compliant Container Images
▪ Having an industry standard Container Image Format allows interoperability between all
of these different platforms
49
Container Host
• The container host is the system that runs the containerized
processes, often simply called containers
• This could be, for example, RHEL Atomic Host running in a VM, as an
instance in the public cloud, or on bare metal in your datacenter
• Once a container image (aka repository) is pulled from a Registry
Server to the local container host, it is said to be in the local cache
50
25
9/13/2024
Container Orchestration
• A container orchestrator does two things
a. Dynamically schedules container workloads within a cluster of computers
b. Provides a standardized application definition file (kube yaml, docker
compose, etc)
• The need for container orchestrator arises due to the requirement for
building multiple containers and deploying them together as a unit
o These containers may be pushed into a pipeline (Dev/QA/Prod) leading
towards production
51
Container Orchestration
• Allows containers within an application to be scheduled completely
separately
• This is useful if:
o The utilization of large clusters of Container Hosts required
o Individual containers fail (process hang, out of memory (OOM))
o Container Hosts fail (disk, network, reboot)
o Container Engines fail (corruption, restart)
o Individual containers need to be scaled up, or scaled down
52
26
9/13/2024
53
As shown in the figure, these three technologies exist at three different layers in an
architecture
54
27
9/13/2024
55
56
28
9/13/2024
57
58
29
9/13/2024
59
60
30
9/13/2024
61
62
31