Unit 3
Virtualization – Basics, Cloud vs Virtualization, Types of virtualization,
Hypervisor types; Containers – Introduction to dockers and containers,
containerization vs virtualization, docker architecture, Use cases, Learn how to
build container images, Operations on container images; Kubernetes – Need for
orchestration, container orchestration methods, Introduction to Kubernetes,
Kubernetes architecture, using YAML file, Running Kubernetes via minikube.
                                             Introduction
• Virtualization is an enabling technology for the different cloud computing services.
• Virtualization is a technology that enables the single physical infrastructure to function as a multiple
  logical infrastructure or resources.
• Virtualization is not only limited to the hardware, it can take many forms such as memory, processor,
  I/O, network, OS, data, and application.
• Before virtualization, the single physical infrastructure was used to run a single OS and its applications,
  which results in underutilization of resources. The nonshared nature of the hardware forces the
  organizations to buy a new hardware to meet their additional computing needs.
• After virtualization was introduced, different OSs and applications were able to share a single physical
  infrastructure.
Before Virtualization
After Virtualization
                                 What is Virtualization ?
• Virtualization is originated in the1960s at IBM.
• Virtualization is the "creation of a virtual (rather than
   actual) version of something, such as a server, a
   desktop, a storage device, an operating system or
   network resources".
• In other words, Virtualization is a technique, which
   allows to share a single physical instance of a resource
   or an application among multiple customers and
   organizations.
• Virtualization allows concurrent execution of multiple OSs
   (and their applications) on the same physical machine.
                                   Virtualization….
• Virtualization creates a virtual layer using the
   hypervisor software, which manages resources assigned
   to the virtual instances. The newly formed virtual
   representation is known as virtual machines (VMs).
• Virtual resources = each OS thinks that it “owns”
   hardware resources
• Virtualization   layer   =management    of    physical
   hardware (virtual machine monitor, hypervisor)
                                                           VMM Goals: Fidelity
• Virtual machine (VM) = OS+ applications + virtual
                                                                       Performance
   resources (guest domain).
                                                                       Safety & isolation
Virtual machines and hypervisors are two important concepts in virtualization.
    • Virtual machine: A virtual machine is a software-defined computer that runs on a physical
      computer with a separate operating system and computing resources (VM is an emulation or
      a virtual presentation of a physical system). The physical computer is called the host
      machine and virtual machines are guest machines. Multiple virtual machines can run on a
      single physical machine. Virtual machines are abstracted from the computer hardware by a
      hypervisor.
    • Hypervisor: The hypervisor is a software component that manages multiple virtual
      machines in a computer. It ensures that each virtual machine gets the allocated resources and
      does not interfere with the operation of other virtual machines.
                               Virtualization Vs Cloud
                               Virtualization                                       Cloud
  Definition                    Technology                                     Methodology
              Create multiple simulated environments from 1      Pool and automate virtual resources for
Purpose
              physical hardware system                           on-demand use
              Deliver packaged resources to specific users for   Deliver variable resources to groups of
Use
              a specific purpose                                 users for a variety of purposes
Configuration Image-based                                        Template-based
Lifespan      Years (long-term)                                  Hours to months (short-term)
               High capital expenditures (CAPEX), low            Private cloud: High CAPEX, low OPEX
Cost
               operating expenses (OPEX)                         Public cloud: Low CAPEX, high OPEX
Scalability    Scale up                                          Scale out
Workload       Stateful                                          Stateless
Tenancy        Single tenant                                     Multiple tenants
        Advantages and Disadvantages of Virtualization
• Industries adopt virtualization in their organization because of the following benefits:
    •   Better resource utilization
    •   Increases ROI (return on investment )
    •   Dynamic data center
    •   Supports green IT
    •   Eases administration
    •   Improves disaster recovery
• While virtualization offers many benefits, it also has some drawbacks:
    •   Single point of failure
    •   Demands high-end and powerful infrastructure
    •   May lead to lower performance
    •   Requires specialized skill set
                          Benefits of Virtualization
• Consolidation: It is this ability to run multiple virtual machines, with their operating systems
   and applications on a single physical platform.
        - Decrease cost, improve manageability (with fewer admins and with fewer electrical bills)
• Migration: Migrate the OS in the applications from one physical machine to another physical
   machine.
        - Greater availability of the services, improve reliability
• Security: As the OS and the applications are nicely encapsulated in a virtual machine. It
   becomes more easy to contain any kinds of bugs, or any kinds of malicious behavior, to those
   resources that are available to the virtual machine only, and not to potentially affect the entire
   hardware system.
• Some other benefits: Debugging, Provide affordable Support for legacy OSs
                                              Vu Pham
                            Virtualization example
Consider a company that needs servers for three functions:
    1. Store business email securely
    2. Run a customer-facing application
    3. Run internal business applications
Each of these functions has different configuration requirements:
    • The email application requires more storage capacity and a Windows operating system.
    • The customer-facing application requires a Linux operating system and high processing power to
      handle large volumes of website traffic.
    • The internal business application requires iOS and more internal memory (RAM).
• To meet these requirements, the company sets up three different dedicated physical servers for each
  application. The company must make a high initial investment and perform ongoing maintenance and
  upgrades for one machine at a time. The company also cannot optimize its computing capacity. It pays 100%
  of the servers’ maintenance costs but uses only a fraction of their storage and processing capacities.
• Efficient hardware use: With virtualization, the company creates three digital servers, or virtual machines,
  on a single physical server. It specifies the operating system requirements for the virtual machines and can
  use them like the physical servers. However, the company now has less hardware and fewer related
  expenses.
• Infrastructure as a service: The company can go one step further and use a cloud instance or virtual
  machine from a cloud computing provider such as AWS. AWS manages all the underlying hardware, and the
  company can request server resources with varying configurations. All the applications run on these virtual
  servers without the users noticing any difference. Server management also becomes easier for the company’s
  IT team.
                                       Hypervisors
• Before hypervisors are introduced, there was a one-to-one relationship between hardware and
  OSs.
         - This type of computing results in underutilized resources.
• After the hypervisors are introduced, it became a one-to-many relationship. With the help of
  hypervisors, many OSs can run and share a single hardware.
• The virtual environment can be created with the help of a software tool called hypervisors.
• Hypervisors are the software tool that sits in between VMs and physical infrastructure and
  provides the required virtual infrastructure for VMs.
• Generally, the virtual infrastructure means virtual CPUs (vCPUs), virtual memory, virtual NICs
  (vNICs), virtual storage, and virtual I/O devices.
• The hypervisors are also called VMM(Virtual Machine Monitors).
• They are the key drivers in enabling virtualization in cloud data centers.
• There are different hypervisors that are being used in the IT industry.
• Some of the examples are VMware, Xen, Hyper-V, KVM, and OpenVZ.
                               Types of Hypervisors
Hypervisors are generally classified into two categories:
1. Bare-metal hypervisor
   or Native Hypervisor (Type 1)
2. Hosted Hypervisor (Type 2)
                     Bare-metal hypervisor(Type 1)
• Type 1 hypervisor is also known as bare metal or native hypervisor.
• It can run and access physical resources directly without the help of any host OS.
• Here, the additional overhead of communicating with the host OS is reduced and offers
  better efficiency when compared to type 2 hypervisors.
• This type of hypervisors is used for servers that handle heavy load and require more
  security.
• Some examples of type 1 hypervisors include Microsoft Hyper-V, Citrix XenServer,
  VMWare ESXi, and Oracle VM Server for SPARC.
             Bare-metal virtualization model
             Bare-metal hypervisor (Type 1)
                VMM (hypervisor) manages all
                hardware resources and supports
                execution of entire VMs.
                Privileged, service VM to deal with
                devices (and other configuration
                and management task)
Cloud Computing and Distributed Systems   Vu Pham   Virtualization
                        Hosted Hypervisor(Type 2)
• Type 2 hypervisors are also known as embedded or hosted hypervisors.
• This type of hypervisors requires the host OS and does not have direct access to the physical
  hardware.
• These types of hypervisors are installed on the host OS as a software program.
• The host OS is also known as physical host, which has the direct access to the underlying
  hardware.
• The major disadvantage of this approach is if the host OS fails or crashes, it also results in
  crashing of VMs.
• So, it is recommended to use type 2 hypervisors only on client systems where efficiency is
  less critical.
• Examples of type 2 hypervisors include VMWare Workstation and Oracle Virtualbox.
             Hosted Hypervisor
             Hosted Hypervisor (Type 2)
                In this model, at the lowest level,
                there is a full fledged host OS that
                manages all of the hardware
                resources.
                The Host OS integrates a VMM
                module, that's responsible for
                providing the virtual machines with
                their virtual platform interface and
                for managing all of the context
                switching scheduling, etc.
Cloud Computing and Distributed Systems      Vu Pham   Virtualization
Hypervisors in the market
                             Bare-metal Hypervisors
      • This model is adapted by the Xen virtualization solution
          (open source or Citrix Xen Server) and also by the
          VMware's hypervisor, the ESX hypervisor.
 (i) Xen (Open source or Citrix Xen Server)
      - The VMs that are run in the virtualized environment
        are referred to as domains.
      - The privileged domain is called dom 0, and the guest
        VMs are referred to as domUs.
      - Xen is the actual hypervisor and all of the drivers are
        running in the privileged domain, in dom 0.
(ii) ESX (VMware)
     -Given that VMware and its hypervisors were first to market, VMware still owns the largest
      percentage of virtualized server cores. So these server cores run the ESX hypervisor and also
      provide the drivers for the different devices. That are going to be part of the hypervisor. To
      support a third party community of developers VMware exports a number of APIs.
                                            Vu
                           Hosted Hypervisor
Example:
  • KVM (Kernel-based VM) Based on
    Linux
  • KVM kernel module + hardware
    emulator called QEMU for hardware
    virtualization
  • Leverages large Linux open-source
    community
                                     Protection Rings
• Protection rings are used to isolate the OS from
  untrusted user applications. The OS can be protected
  with different privilege levels.
• In protection ring architecture, the rings are arranged
  in hierarchical order from ring 0 to ring 3.
• Ring 0 contains the programs that are most privileged,
  and ring 3 contains the programs that are least
  privileged.
• Normally, the highly trusted OS instructions will run
  in ring 0, and it has unrestricted access to physical
  resources.
• Ring 3 contains the untrusted user applications, and it
  has restricted access to physical resources.
• The other two rings (ring 1 and ring 2) are allotted for
  device drivers.
• This protection ring architecture restricts
  the misuse of resources and malicious
  behaviour of untrusted user-level
  programs.
• For example, any user application from
  ring 3 cannot directly access any physical
  resources as it is the least privileged level.
• But the kernel of the OS at ring 0 can
  directly access the physical resources as it
  is the most privileged level.
                           Types of Virtualization
The different types of virtualization are:
   1) Desktop Virtualization
   2) Network Virtualization
   3) Storage Virtualization
   4) Application Virtualization
                Server Virtualization
• Server Virtualization is the process of dividing a physical
  server into several virtual servers, called virtual private
  servers. Each virtual private server can run
  independently.
• The concept of Server Virtualization widely used in
  the IT infrastructure to minimizes the costs by
  increasing the utilization of existing resources.
                               Desktop Virtualization
• In this type of virtualization, we can run multiple operating
  systems, each in its own virtual machine on the same system.
• Types of desktop virtualization:
    1. Virtual desktop infrastructure (VDI) runs numerous virtual
      machines on a central server and then hosts it to the host system
      according to the user's requirements. In this way, we can access
      any operating system from any device without installing the
      actual operating system in their local machine.
    2. Local desktop virtualization is the type that runs the hypervisor
      on the local system, which allows the user to install multiple
      operating systems simultaneously without affecting the host's
      operating system.
                                Network Virtualization
• This type of virtualization can combine multiple physical networks
  into one virtual, software-based network, or it can divide one
  physical network into separate, independent virtual networks.
• Types of network virtualization:
    1. Software-defined networking (SDN) virtualizes hardware that
      controls network traffic routing.
    2. Network function virtualization (NFV) virtualizes hardware
      appliances that provide network-specific functions easier to
      configure and manage, e.g., firewall, etc.
                            Storage Virtualization
• This virtualization enables all the storage devices on the system to be accessed and be
 managed as a single storage unit pool for better maintenance.
• The management and provision of storage are made by the software.
• All the storage is formed in a shared pool from which they can be allotted to any VM on
 the system.
                             Application Virtualization
• In this virtualization process, the application runs without the need of
  installing it into the system, as they run on a virtual environment.
• Types of virtualization:
    1. Local application virtualization runs on the host device but runs
       in a virtual environment, not in the hardware.
    2. Application virtualization, the application is on the server-side,
       and it sends some components to the host device according to the
       requirement.
    3. Server-based application virtualization runs only on the server-
       side and sends the only interface to the client system.