Cloud Computing Virtualization Containers
Cloud Computing Virtualization Containers
Topics Covered:
● Characteristics of Virtualized Environments
● Taxonomy of Virtualization Techniques
● Virtualization and Cloud Computing
● Pros and Cons of Virtualization
● Technology Examples: XEN and VMware
● Building Blocks of Containers
● Container Platforms: LXC and Docker
● Container Orchestration: Docker Swarm and Kubernetes
● Public Cloud VM (Amazon EC2) and Container (Amazon ECS) Offerings
1. Virtualization — Introduction
Virtualization is the technology that allows you to create multiple simulated environments (virtual
machines) from a single physical hardware system. Think of it like dividing one big computer
into several smaller, independent computers — each running its own operating system and
applications.
💡 Simple Analogy
Imagine a large apartment building. The entire building is the physical server. Each
apartment is a virtual machine (VM). Each apartment has its own kitchen, bedroom,
bathroom — residents live independently without interfering with others. The building
manager (hypervisor) manages everything.
Virtualized environments have several key characteristics that make them powerful and flexible:
A. Partitioning
A single physical machine is divided into multiple virtual machines. Each VM gets its own share
of CPU, memory, storage, and network resources.
● Multiple operating systems run simultaneously on one server
● Resources are divided/allocated as needed
● Each VM is isolated from others
B. Isolation
Each virtual machine is completely isolated from others. If one VM crashes, it does NOT affect
other VMs running on the same hardware.
● Fault isolation: crashes in one VM don't spread
● Security isolation: VMs can't access each other's data
● Performance isolation: one VM can't consume all resources (resource limits apply)
C. Encapsulation
An entire VM (operating system, applications, files) is stored as files on disk. This makes VMs
easy to:
● Move from one server to another (migration)
● Back up and restore
● Clone (copy) quickly
D. Hardware Independence
Virtual machines do not depend on the physical hardware they were created on. They can be
moved to any server and will work the same way.
E. Resource Pooling
Physical resources (CPU, RAM, storage) are pooled together and shared dynamically across
multiple VMs. Resources can be added or removed without downtime.
Virtualization is not just one technique — there are several types, each used for different
purposes:
1. Full Virtualization
The guest operating system runs without any modifications. The hypervisor completely
simulates the hardware. The guest OS doesn't even know it's running in a virtual environment.
● Examples: VMware Workstation, VirtualBox
● Advantage: Any OS can run without modification
● Disadvantage: Slightly slower due to full hardware simulation
2. Para-Virtualization
The guest OS is modified slightly to communicate directly with the hypervisor. This makes it
faster than full virtualization.
● Examples: Xen (paravirtualization mode)
● Advantage: Better performance
● Disadvantage: Guest OS must be modified
3. Hardware-Assisted Virtualization
Modern CPUs (Intel VT-x, AMD-V) have built-in support for virtualization. The hypervisor uses
these CPU features to run VMs efficiently without software tricks.
● Examples: KVM (Kernel-based Virtual Machine)
● Advantage: Near-native performance
5. Network Virtualization
Physical network resources are combined and divided into virtual networks. Example: VLANs
(Virtual Local Area Networks), SDN (Software-Defined Networking).
6. Storage Virtualization
Multiple physical storage devices appear as one large storage pool. Examples: SAN (Storage
Area Networks), NAS solutions.
Advantage Explanation
Cost Savings Fewer physical servers needed → lower hardware, power, cooling, and
space costs. One server can do the job of 10!
Server Consolidation Run multiple workloads on a single server instead of buying a server for
each application.
Easy Backup & VMs are files → take a snapshot before making changes. If something
Recovery breaks, restore instantly.
Faster Deployment Spin up a new server in minutes (vs. days/weeks to buy and set up
physical hardware).
Testing & Developers can create isolated test environments quickly without affecting
Development production systems.
High Availability VMs can be live-migrated to another server if hardware fails — zero or
minimal downtime.
Energy Efficiency Running fewer servers means consuming less electricity — better for
environment and budget.
Scalability Easily add more VMs when load increases, and remove them when not
needed.
Disadvantage Explanation
Performance Hypervisor adds a layer between hardware and VMs — there's always
Overhead some performance loss compared to running directly on hardware.
High Initial Cost Powerful servers capable of running many VMs and good storage are
expensive upfront.
Complexity Managing many VMs, hypervisors, and virtual networks can be complex
and requires skilled staff.
Security Risks If the hypervisor is compromised, ALL VMs on that server could be at risk
(hypervisor attacks).
VM Sprawl Easy creation of VMs can lead to too many unused VMs, wasting
resources and making management harder.
Single Point of If the physical server fails and no redundancy is in place, all VMs on it go
Disadvantage Explanation
Failure down.
4. Technology Examples: XEN and VMware
Xen is a free and open-source hypervisor developed at the University of Cambridge. It is a Type
1 (bare-metal) hypervisor — it runs directly on the hardware without a host OS.
XEN Architecture
+-------------------------------------------------------+
| Physical Hardware |
+-------------------------------------------------------+
| XEN HYPERVISOR |
+-----------+------------+------------+----------------+
| Domain 0 | Domain U | Domain U | Domain U |
| (Dom0) | (DomU 1) | (DomU 2) | (DomU 3) |
| Privileged| Guest OS 1 | Guest OS 2 | Guest OS 3 |
| Linux OS | (unprivil.)| (unprivil.)| (unprivil.) |
| Controls | Apps | Apps | Apps |
| hardware | | | |
+-----------+------------+------------+---------------+
VMware is the industry leader in virtualization technology. It provides both Type 1 (bare-metal)
and Type 2 (hosted) hypervisors and a complete suite of virtualization products.
Containers are a lightweight alternative to virtual machines. While VMs virtualize hardware,
containers virtualize the operating system. Multiple containers share the same OS kernel but
are isolated from each other.
💡 VM vs Container Analogy
Virtual Machines are like separate houses — each has its own foundation, walls, plumbing,
electricity (full OS). Containers are like apartments in one building — they share the
building's infrastructure (OS kernel) but each has its own space (isolated environment).
1. Linux Namespaces
Namespaces provide isolation. Each container gets its own view of system resources. The
container thinks it has its own OS, but it's actually sharing the kernel.
● Processes in a container get their own process IDs. Container can't see processes
outside [Link] Namespace:
● Each container gets its own network interface, IP address, and routing
[Link] Namespace:
● Each container has its own filesystem [Link] Namespace:
● Containers can have their own user [Link] Namespace:
● Each container can have its own [Link] Namespace:
4. Container Runtime
The container runtime is the software responsible for running containers. It uses namespaces,
cgroups, and UnionFS to create and manage containers.
● Low-level runtimes: runc (OCI standard runtime), containerd
● High-level runtimes: Docker (uses containerd under the hood)
5. Container Image
A container image is a read-only template used to create containers. It includes everything the
application needs: code, runtime, libraries, environment variables, and config files.
● Images are stored in registries: Docker Hub, Amazon ECR, Google Container Registry
● Image = Base Image + Layers of changes (defined in Dockerfile)
6. Container Platforms: LXC and Docker
LXC is one of the earliest Linux container technologies. It provides OS-level virtualization using
Linux namespaces and cgroups. LXC containers behave more like lightweight VMs — they run
a full Linux system inside the container.
💡 LXC vs Docker
LXC is designed to run a full Linux OS in a container (like a lightweight VM). Docker is
designed to run a single application in a container. Docker is more popular for application
deployment.
LXC Architecture
LXC Architecture
+---------------------------------------------------+
| Physical / Virtual Server |
+---------------------------------------------------+
| Linux Kernel |
| (Namespaces + cgroups) |
+---------------+------------------+---------------+
| LXC Container| LXC Container | LXC Container|
| Full Linux | Full Linux | Full Linux |
| System (mini)| System (mini) | System (mini)|
| Multiple Apps| Multiple Apps | Multiple Apps|
+---------------+------------------+---------------+
6.2 Docker
Docker is the most popular containerization platform today. Released in 2013, it made
containers easy to use with simple commands and a vast ecosystem. Docker is designed for
running single applications in containers.
Docker Architecture
Docker Architecture
+-----------+ CLI Commands +------------------+
| Developer |-------------------->| Docker Client |
| (You) | docker build/run | (docker CLI) |
+-----------+ +------------------+
|
Docker API (REST)
|
v
+--------------------+
| Docker Daemon |
| (dockerd) |
| Manages images, |
| containers, |
| networks, volumes|
+--------------------+
| |
+------+ +-----+------+
| |
+-------------+ +-----------+------+
| containerd | | Docker Hub |
| (Runtime) | | (Image Registry) |
+------+------+ +------------------+
|
+------+------+
| runc |
| (OCI runtime|
| Creates |
| Containers) |
+-------------+
💡 Why Orchestration?
Imagine 500 containers running your app. One crashes — who restarts it? Traffic spikes —
who adds more containers? A server fails — who moves containers to another server?
Orchestration tools do all this automatically.
Docker Swarm is Docker's built-in orchestration tool. It turns a group of Docker hosts (servers)
into a single, virtual Docker host — called a Swarm.
Kubernetes Architecture
+------------------------------------------------------------------+
| KUBERNETES CLUSTER |
+------------------------------------------------------------------+
| CONTROL PLANE (Master Node) |
| +------------+ +----------+ +------------------+ +-----------+ |
| | API Server | |Scheduler | |Controller Manager| | etcd | |
| |(Entry point)| |(Places | |(Maintains desired| |(Key-value | |
| | | | Pods on | | state) | | store for | |
| | | | nodes) | | | | cluster | |
| | | | | | | | data) | |
| +------------+ +----------+ +------------------+ +-----------+ |
+------------------------------------------------------------------+
| WORKER NODES |
| +----------------------+ +----------------------+ |
| | Worker Node 1 | | Worker Node 2 | |
| | +---------+ | | +---------+ | |
| | | kubelet| | | | kubelet| | |
| | +---------+ | | +---------+ | |
| | | kube- | | | | kube- | | |
| | | proxy | | | | proxy | | |
| | +---------+ | | +---------+ | |
| | +--+ +--+ +--+ | | +--+ +--+ +--+ | |
| | |P1| |P2| |P3| | | |P4| |P5| |P6| | |
| | +--+ +--+ +--+ | | +--+ +--+ +--+ | |
| | Pods (containers) | | Pods (containers) | |
| +----------------------+ +----------------------+ |
+------------------------------------------------------------------+
Key Kubernetes Concepts
● The smallest deployable unit in Kubernetes. A Pod contains one or more tightly-
coupled containers that share network and storage. Usually 1 container per
[Link]:
● A server (physical or VM) that runs Pods. Has kubelet (agent), kube-proxy
(networking), and container [Link]:
● A set of nodes managed by [Link]:
● The front-end of the Kubernetes control plane. All commands and communication
go through [Link] Server:
● A distributed key-value store that holds all cluster configuration and state
[Link]:
● Decides which node to run a new Pod on, based on resource
[Link]:
● Continuously checks that the current state matches the desired state. If a Pod
dies, it creates a new [Link] Manager:
● Agent running on each worker node. Talks to API server and manages Pods on
that [Link]:
● Handles networking rules on each node. Routes traffic to the right [Link]-
proxy:
Amazon Web Services (AWS) is the world's largest cloud provider. It offers both Virtual Machine
(EC2) and Container (ECS) services.
Amazon EC2 is AWS's virtual machine service. It provides resizable virtual servers (called
instances) in the cloud. You can launch a virtual server in minutes and pay only for what you
use.
Amazon ECS is AWS's managed container orchestration service. It allows you to run Docker
containers at scale without managing servers. Think of ECS as a managed Kubernetes/Docker
Swarm, but simpler and deeply integrated with AWS services.
Amazon ECS Architecture
+-----------------------------------------------------------+
| AWS CLOUD |
| +--------------------+ +----------------------------+ |
| | ECS CONTROL | | Docker Image Registry | |
| | PLANE | | Amazon ECR | |
| | (Managed by AWS) | | (Elastic Container | |
| | | | Registry) | |
| +--------------------+ +----------------------------+ |
| | | |
| v v |
| +----------------------------+ Pulls Images |
| | ECS CLUSTER | |
| | | |
| | LAUNCH TYPE 1: EC2 | LAUNCH TYPE 2: Fargate |
| | +---------+ +---------+ | +---------+ +---------+ ||
| | |EC2 Node | |EC2 Node | | |Container| |Container| ||
| | |[C1][C2] | |[C3][C4] | | |(No serv-| |(No serv-| ||
| | +---------+ +---------+ | | er mgmt)| | er mgmt)| ||
| | You manage EC2 instances | +---------+ +---------+ ||
| +----------------------------+ AWS manages everything |
+-----------------------------------------------------------+
Key Takeaways
Virtualization Creates multiple VMs from one physical server using a hypervisor
VM Characteristics Partitioning, Isolation, Encapsulation, Hardware Independence
Virtualization Types Full, Para, HW-Assisted, OS-Level (Containers), Network, Storage
Cloud + Virtualization Virtualization enables multi-tenancy, elasticity, and pay-as-you-go
cloud
Pros of Virtualization Cost savings, consolidation, easy backup, fast deployment,
scalability
Cons of Virtualization Performance overhead, complexity, security risks, VM sprawl
XEN Open-source Type 1 hypervisor. Dom0 controls DomU guests. Used
by AWS historically
VMware Commercial Type 1 hypervisor. Features: vMotion, HA, DRS.
Industry leader
Container Basics Uses namespaces, cgroups, UnionFS. Lighter than VMs. Shares
OS kernel
LXC Full OS in a container. More like lightweight VM. Predecessor to
Docker
Docker Single app per container. Image → Container workflow. Docker Hub
for images
Docker Swarm Docker's orchestration. Simple setup. Managers + Workers. Good
for small scale
Kubernetes Powerful orchestration. Pods, Deployments, Services. Control Plane
+ Workers
Amazon EC2 AWS virtual machines. Pay-per-hour. Auto Scaling. Multiple
instance types
Amazon ECS AWS container service. Task Definitions + Services. EC2 or Fargate
mode