Introduction to Virtual Machines
A virtual machine is a software-based emulation of a physical computer. The Cycle Platform is capable of deploying and running virtual machines within an environment, managing the underlying complexities of configuration, networking, and orchestration.
Virtual machines are best for situations where complete isolation is desired, when migrating a legacy application to Cycle, or when a custom kernel is required.
How Virtual Machines Work on Cycle
In many ways, virtual machines function similarly to containers on Cycle. They are deployed into environments and connected to the environment's private network, meaning they can easily communicate with other containers and virtual machines within the same environment without additional configuration.
When deploying a virtual machine on Cycle, the platform creates a hidden container instance running a hypervisor and QEMU/KVM inside. The platform manages the hypervisor container automatically behind the scenes, and it isn't required to interact with this hidden container at any point - eliminating the need for manual configuration.
Base Image
A virtual machine utilizes a bootable disk image that must be specified when creating the virtual machine. Unlike container images, virtual machine images are much larger in size, contain an entire OS and kernel, are bootable and tied specifically to a virtual machine.
Virtual machine images cannot be managed independently, unlike container images. In addition, a virtual machine cannot be reimaged after it has been created. Virtual machine images are generally more 'generic' than container images, and are treated more like a 'pet' than 'cattle'.
For more details on virtual machine base images and options, see here.
Resource Management
Virtual machines can define CPU and RAM resource limits and allocations. Setting a limit defines the maximum amount of CPU or RAM a virtual machine can use, and setting allocations ensure those resources will always be available to the virtual machine regardless of other workloads on the server. It is highly recommended to set resource limits, as virtual machines tend to be resource greedy.
Storage
When deploying a virtual machine, Cycle automatically creates two volumes:
- Meta Volume - Stores a few metadata files along with the UEFI flash ROM required for booting the virtual machine.
- Base Volume - Contains the virtual machine's disk image. This volume is created from the selected virtual machine image and includes the installed operating system. For example, if the chosen image is a 10GB Alpine Linux disk, the base volume will be a 10GB block device with Alpine preinstalled. This size is customizable, but must be at least the same size as the disk in the image.
If additional storage is needed, extra block devices can be attached when creating the virtual machine. These additional devices are blank and can be formatted or used as needed by the virtual machine.
Serial Console Over SSH
The serial console of a virtual machine can be accessed via Cycle's console proxy service, providing access to the virtual machine before, during, and after boot. This works similarly to the two-way console of a container instance.
Server Requirements
In order to deploy virtual machines, the cluster must have at least one server with the hypervisor
feature. Hypervisor servers
are tagged in the API/Portal as such, and indicate a server that supports either virtualization, or nested virtualization. Not all
infrastructure providers have servers that support virtualization.
Comparison to Containers
Generally, container-based applications and services should be preferred over deploying virtual machines. However, virtual machines may be ideal for services with sensitive security requirements, legacy application migrations, or powering private cloud and data center offerings with Cycle.
Below is a table comparing containers and virtual machines on Cycle.
Feature | Containers | Virtual Machines (VMs) |
---|---|---|
Isolation | Process-level isolation, shared kernel | Full isolation with separate OS |
Performance | Lightweight, faster startup | Heavier, slower startup |
Resource Usage | Efficient, uses less CPU and RAM | Requires more CPU and RAM |
Operating System | Shares host OS kernel | Each virtual machine has its own OS |
Scalability | Instances can be scaled up or down | Not scalable |
Use Case | Microservices, scalable apps | Legacy apps, custom kernels, security sensitive apps |
Security | Kernel-level isolation | Full OS isolation |
Startup Time | Seconds or milliseconds | Minutes |
Overhead | Minimal (single kernel shared) | Significant (full OS per virtual machine) |
Get Started with Virtual Machines
Discover how to deploy and manage virtual machines on the Cycle Platform: