Tytus Kurek
on 21 August 2023
What is a hypervisor? A beginner’s guide
In the realm of virtualisation and cloud computing, the hypervisor is a critical component that enables the seamless operation of multiple virtual machines (VMs) on a single host. While virtualisation is a technology, the hypervisor is its actual implementation. In this beginner’s guide, we will explore the fundamentals of hypervisors, their types, and how they differ from container runtimes. We will also review some of the leading hypervisors available today.
What is a hypervisor?
A hypervisor is a software or hardware component that enables the creation and management of virtual machines. It abstracts the underlying physical resources, such as processors, memory and devices, and allows multiple VMs (guests) to run simultaneously on a single physical machine (the host) while ensuring full resource separation. Each VM operates as a self-contained entity with its own operating system, kernel and applications. Hypervisors play a crucial role in maximising hardware utilisation. They improve an organisations’ flexibility, and reduce data centre costs in modern cloud environments.
Types of hypervisors
There are two primary types of hypervisors that are commonly used these days:
- Type 1 hypervisors (bare metal hypervisors) – run directly on the host without the need for an underlying operating system. Since Type 1 hypervisors interact directly with the hardware, they usually offer superior performance and efficiency. Common examples of Type 1 hypervisors include KVM (Kernel-based Virtual Machine), VMware vSphere Hypervisor (ESXi), Microsoft Hyper-V Server, and Xen.
- Type 2 hypervisors (hosted hypervisors) – run on top of a host operating system in the user space. They are usually more user-friendly and suitable for desktop or development environments. However, they introduce some overhead due to the additional layer between the hypervisor and the hardware. Common examples of Type 2 hypervisors include VMware Workstation, VirtualBox, and Parallels Desktop.
Hypervisor vs container runtime
While both hypervisors and container runtimes facilitate the creation of virtual entities, they serve different purposes, and their way of working differs slightly underneath.
As explained earlier, hypervisors virtualise hardware resources, allowing multiple VMs to run independently on a single server. Each VM includes its own complete operating system (OS), making it possible to run diverse workloads on the same hardware and host OS. This isolation provided by the hypervisor ensures a high level of security but comes with a slight performance overhead. Traditional VMs are ideal for legacy, monolithic applications that haven’t been re-architected yet or are not planned to be, as well as various types of resource-intensive workloads, such as data analytics.
Containers, on the other hand, operate at the application level only, enabling the packaging and isolation of individual applications and their dependencies. Container runtimes, like Docker and containerd, share the kernel of the host and don’t virtualise the underlying hardware. Containers are ideal for deploying modern cloud-native applications based on the microservice architecture, enabling scalability and rapid deployment.
Industry-leading hypervisors
Several hypervisors have garnered widespread adoption in the tech industry. Some of the leading options include:
- KVM – an open source, cost-effective Type 1 hypervisor that is tightly integrated with the Linux kernel. Its architecture uses hardware virtualisation extensions found in modern processors, providing high performance and scalability. KVM is widely used in various cloud platforms, including Google Cloud, and its adoption continues to grow rapidly.
- VMware vSphere Hypervisor (aka ESXi) – VMware’s proprietary Type 1 hypervisor. The default and only possible option when building a VMware-based infrastructure. Even though ESXi stands out for its stability, VMware users often seek more cost-effective options due to the high licensing costs associated with the usage of VMware products.
- Microsoft Hyper-V Server – another proprietary Type 1 hypervisor, capable of running on Windows Server installations. It offers seamless integration with Microsoft’s ecosystem, making it a popular choice for organisations that invested heavily in Microsoft’s technologies.
Get started with the KVM hypervisor on Sunbeam
Now that you’ve got some basic understanding of what a hypervisor is, it is time to try it out. Hypervisors can best be experienced in conjunction with a robust cloud platform. Therefore, in the following steps, we’ll walk you through the necessary steps to install OpenStack Sunbeam on your Ubuntu machine with minimal effort. OpenStack is the world’s most popular open source cloud platform, and Sunbeam is the simplest possible way to get started with OpenStack. Sunbeam uses the KVM hypervisor underneath.
Start by grabbing a fresh physical or virtual machine (yes, you can do nested virtualisation) with 4+ core amd64 CPU, 16 GB of RAM, 50 GB of storage and the latest Ubuntu Server LTS installed. Then follow the instructions below:
Install OpenStack
In order to install OpenStack, execute the following command:
$ sudo snap install openstack
Install dependencies
In order to install all necessary dependencies, execute the following command:
$ sunbeam prepare-node-script | bash -x && newgrp snap_daemon
Bootstrap the cloud
In order to bootstrap the cloud, execute the following command:
$ sunbeam cluster bootstrap --accept-defaults
This command takes a while to finish. Be patient.
Configure the cloud
In order to configure the cloud with default options, execute the following command:
$ sunbeam configure --accept-defaults --openrc demo-openrc
For more advanced scenarios, refer to guided installation instructions.
Launch a VM
In order to launch your first VM, execute the following command:
$ sunbeam launch ubuntu --name test
Sample output:
Access instance with `ssh -i /home/ubuntu/.config/openstack/sunbeam [email protected]`
At this point, the VM should be accessible over the SSH protocol. In order to connect to it, execute the command from the output:
$ ssh -i /home/ubuntu/.config/openstack/sunbeam [email protected]
That’s it. You’re connected to the VM. You can use regular shell commands to execute various tasks.
$ uptime
11:08:36 up 2 min, 1 users, load average: 0.05, 0.05, 0.01
Take the Next Step
Hypervisors are an essential component of virtualisation technology, enabling efficient utilisation of hardware resources and facilitating the management of guest VMs. Out of various hypervisors available out there, the KVM hypervisor stands out for its cost-effectiveness and unparalleled performance. To truly harness the potential of virtualisation in your infrastructure without hassle, use extensions like OpenStack and Sunbeam.
- Visit our website to read more about Sunbeam and OpenStack.
- Learn virtualisation through a series of tutorials for beginners.
- Install Sunbeam on your workstation in five simple steps.
- Watch our webinar and build your own cloud in under an hour.
- Get in touch with Canonical for commercial support on Ubuntu.
Further Reading
Learn more about Canonical’s open source infrastructure solutions.