How to Provision a Virtual Machine#
Learn how to provision a virtual machine in your project. The examples below match the demo-virtual-machine shown in the console screenshots.
Emma, a developer at ACME Corp, needs a Linux virtual machine for her development environment. She can provision a VM with a chosen OS, instance size, and network connectivity in minutes.
Prerequisites#
- A Project already created
- The
virtualmachine.compute.cloud.stakater.comAPI available kubectlconfigured with your project kubeconfig- An SSH public key for VM access
In the Console#
Virtual machines are under Compute in the sidebar. The create form opens in Standard mode and asks for the same things the minimal claim below does: a name, a flavour and an instance type.
Advanced reveals the rest of the claim further down the form: storage size, the connection mode, the SSH public key and the cloud-init script.
Cloud VM#
Step 1: Prepare Your SSH Key#
Encode your SSH public key as base64:
cat ~/.ssh/id_ed25519.pub | base64 -w 0
Copy the output — you will use it in the sshPublicKey.data field.
Step 2: Define a Minimal VM Claim#
Create a file named vm.yaml with the required parameters:
apiVersion: compute.cloud.stakater.com/v1
kind: VirtualMachine
metadata:
name: demo-virtual-machine
spec:
parameters:
flavour: fedora
instanceType: u1.micro
Required Parameters#
| Parameter | Description |
|---|---|
parameters.flavour |
OS image to use (see Supported Flavours) |
parameters.instanceType |
VM size (see Instance Types) |
Optional Parameters#
| Parameter | Default | Description |
|---|---|---|
parameters.storageSize |
medium (30 Gi) |
Storage size: small (10 Gi), medium (30 Gi), large (50 Gi), xlarge (100 Gi) |
parameters.connection |
private |
Network access: private (no external IP) or public (LoadBalancer Service) |
parameters.sshPublicKey.data |
— | Base64-encoded SSH public key for VM access |
parameters.cloudInit.userData |
— | Cloud-init userData script injected into the VM |
Step 3: Add SSH Key and Network Options#
A more complete example with SSH access and private networking:
apiVersion: compute.cloud.stakater.com/v1
kind: VirtualMachine
metadata:
name: demo-virtual-machine
spec:
parameters:
flavour: rhel9
instanceType: o1.small
storageSize: medium
connection: private
sshPublicKey:
data: <base64-encoded-ssh-public-key>
To make the VM publicly accessible via a LoadBalancer:
spec:
parameters:
flavour: rhel10
instanceType: o1.small
storageSize: medium
connection: public
sshPublicKey:
data: <base64-encoded-ssh-public-key>
Step 4: Cloud-Init Customisation (Optional)#
Use cloudInit.userData to run scripts on first boot:
apiVersion: compute.cloud.stakater.com/v1
kind: VirtualMachine
metadata:
name: demo-virtual-machine
spec:
parameters:
flavour: rhel9
instanceType: o1.medium
connection: private
sshPublicKey:
data: <base64-encoded-ssh-public-key>
cloudInit:
userData: |
#cloud-config
packages:
- git
- curl
- vim
runcmd:
- systemctl enable --now sshd
Step 5: Apply the Claim#
kubectl apply -f vm.yaml
Step 6: Monitor the VM#
Check the VM status:
kubectl get virtualmachine demo-virtual-machine
Wait for the VM to reach Running status:
NAME READY SYNCED PRINTABLE-STATUS AGE
demo-virtual-machine True True Running 3m
The list in the console shows the same status:
The VM's detail page shows the VM status, resources and connection mode. A public VM shows its address here. A private VM is reached over your organisation's mesh, and only the address differs: enrol as described in Create a Mesh, then SSH to the VM's mesh address.
Retrieve the VM's connection details (for public VMs) — the address and the
SSH port, which the platform reports on the claim:
kubectl get virtualmachine demo-virtual-machine \
-o jsonpath='{.status.vm.serviceIP}{"\n"}{.status.vm.serviceHostname}{"\n"}{.status.vm.servicePort}{"\n"}'
SSH into the VM on the port that command reported:
ssh -i ~/.ssh/my-key -p <servicePort> cloud-user@<vm-hostname-or-ip>
Note
Do not assume port 22. New public VMs are exposed on 22, but VMs created
before that became the default are exposed on 22000. status.vm.servicePort
always reports the port the VM's LoadBalancer is really listening on.
Supported Flavours#
| Flavour | Description |
|---|---|
rhel7 |
Red Hat Enterprise Linux 7 |
rhel8 |
Red Hat Enterprise Linux 8 |
rhel9 |
Red Hat Enterprise Linux 9 |
rhel10 |
Red Hat Enterprise Linux 10 |
fedora |
Fedora |
centos-stream9 |
CentOS Stream 9 |
centos-stream10 |
CentOS Stream 10 |
Instance Types#
Common instance types (contact your administrator for the full list):
| Instance Type | Profile |
|---|---|
o1.nano |
Minimal resources |
o1.micro |
Very small |
o1.small |
Small general purpose |
o1.medium |
Medium general purpose |
o1.large |
Large general purpose |
o1.xlarge |
Extra large general purpose |
cx1.medium |
Compute optimised medium |
m1.medium |
Memory optimised medium |
What's Next?#
- Create a Project - Create the project where VMs are deployed
- Create an IAM User - Add users who need VM access
- Provision a Windows Virtual Machine - Provision a Windows VM and connect with Remote Desktop
- Provision an OpenShift Cluster - Provision an OpenShift cluster



