Creating Virtual Machines
PaaS Cloud supports traditional virtual machines powered by KubeVirt. VMs are defined by two separate resources: a vm-disk (storage) and a vm-instance (compute). This guide walks you through creating and accessing a VM using the dashboard or virtctl.
Prerequisites
- Active MetaCentrum membership
- Logged into Chloe Dashboard
- Sufficient tenant quota for CPU, memory, and disk
- (Optional)
virtctlinstalled for CLI access. See Using virtctl.
VM Resources Overview
| Resource | Purpose |
|---|---|
vm-disk | Defines a virtual machine disk (DataVolume / PVC). Can be created from a golden image, HTTP URL, uploaded image, or empty. |
vm-instance | Defines the Virtual Machine instance. References one or more vm-disk resources and specifies instance type, instance profile, networks, and SSH keys. |
Step 1: Create a vm-disk
Before creating a VM instance, you need a disk from which the VM will boot. Disk can be also cloned from already existing instance.
From a Golden Image
Select a pre-built OS image from the dashboard:
source:
image:
name: ubuntuAvailable golden image names correspond to Cozystack instance profiles (e.g., ubuntu, debian, almalinux, windows.2k22). See VM Instance Types for the full list.
From an HTTP URL
Download an image from a remote URL:
source:
http:
url: "https://download.cirros-cloud.net/0.6.2/cirros-0.6.2-x86_64-disk.img"Upload a Local Image
Create an empty disk for upload:
source:
upload: {}After the disk is created, the dashboard provides a virtctl image-upload command. See VM Image Upload for details.
Empty Disk
Create an empty disk to attach to a VM (e.g., for a secondary data volume):
source: {}Optional: CD-ROM
Mark a disk as an optical drive:
optical: trueStep 2: Create a vm-instance
After the disk is ready, create the VM instance.
Required Fields
disks— List of disks to attach. The first disk is always bootable.disks: - name: example-system - name: example-datainstanceType— A predefined hardware template. Default isu1.medium.- Examples:
u1.micro,u1.medium,cx1.2xlarge,m1.2xlarge,rt1.medium - See VM Instance Types for the full catalog.
- Examples:
instanceProfile— A guest OS preference that configures KubeVirt defaults.- Examples:
ubuntu,debian,almalinux,windows.11,windows.2k22
- Examples:
instanceName— A name for the instance.
Optional Fields
sshKeys— List of SSH public keys for authentication (injected via cloud-init).cloudInit— Cloud-init user data for custom provisioning.networks— Networks to attach the VM to. If empty, a default tenant network is used.external— Enable external access from outside the cluster (true/false).externalPorts— Ports to forward externally whenexternalis enabled. Default is[22].gpus— List of GPU resources to attach for GPU passthrough.
Example YAML
apiVersion: cozystack.io/v1alpha1
kind: VMInstance
metadata:
name: my-vm
spec:
instanceType: u1.medium
instanceProfile: ubuntu
disks:
- name: my-vm-system
sshKeys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..."
external: true
externalPorts:
- 22
- 80
- 443Step 3: Access the Virtual Machine
Dashboard Console
- Open the VM details in the dashboard.
- Click Console for a browser-based VNC or serial console session.
virtctl (CLI)
# Serial console
virtctl console <vm-name>
# VNC
virtctl vnc <vm-name>
# SSH (requires external access or a jump host)
virtctl ssh <user>@<vm-name>Default users usually match the OS name (e.g., ubuntu for Ubuntu, debian for Debian, almalinux for AlmaLinux).
Security
Keep private keys secure and never share them. If you generate a key pair inside the dashboard, download the private key immediately and store it safely.
Lifecycle Actions
- Start / Stop / Restart — Use the action menu in the VM list or details page. Under the hood, this changes the KubeVirt
runStrategy(Always,Halted,RerunOnFailure). - Resize — Change the
instanceType(e.g., fromu1.mediumtou1.large) when the VM is stopped. This modifies CPU and memory allocations. - Snapshot — Create a point-in-time snapshot of a
vm-diskfor recovery. - Delete — Remove the
vm-instanceand optionally itsvm-diskresources. Back up data first.
Next Steps
- VM Image Upload — Upload custom OS images.
- Using virtctl — Full CLI reference for VM operations.
- Exposing Services — Publish VM services externally.
- Monitoring and Logs — Observe VM metrics and logs.
