Virtual Machines
To create a VM, start by creating a boot disk, and optionally one or more storage disks, placement groups, and security groups. Then follow the instructions below.
See here for the Virtual Machine API reference
Public IP resources
VMs are automatically assigned a private IPv4 address within your network.
It is possible to create a public IP for a VM by applying a YAML configuration:
$ cat publicip.yaml
apiVersion: networking.evroclabs.net/v1alpha1
kind: PublicIP
metadata:
  name: my-public-ip
$ kubectl apply -f publicip.yaml
publicip.networking.evroclabs.net/my-public-ip created
Note that the
vpcRefmust bedefault-sto-1
Choose a VM resource profile
See here.
SSH access to the VM
See the page on SSH access to VMs.
Creating a Virtual Machine
Once you have created your boot disk, and any security groups, placement group, public IPs, and SSH keys, it is now possible to create a VM.
If you do not need access into your VM from the internet, then you can skip specifying any public IPs. In such a case, you will likely have a secondary VM, or 'jumpbox', which does have a public IP which is used to access this VM.
If you do not need a storage Disk on the VM, then you can skip the second entry to the diskRefs
list, retaining only the boot Disk (denoted with bootFrom: true).
Create a VM by applying a YAML configuration, specifying your chosen VM resource profile:
$ cat vm.yaml
apiVersion: compute.evroclabs.net/v1alpha1
kind: VirtualMachine
metadata:
  name: myvm
spec:
  running: true
  vmVirtualResourcesRef:
    vmVirtualResourcesRefName: general.xs
  placementGroup: my-pg
  diskRefs:
  - bootFrom: true
    name: mybootdisk
  - bootFrom: false
    name: mydisk
  osSettings:
    cloudInitUserData: |
      #cloud-config
      ssh_pwauth: false
      package_update: true
      packages:
      - cryptsetup
      - apt-transport-https
    ssh:
      authorizedKeys:
      - value: "ssh-rsa AAAA..."
  networking:
    securityGroups:
      securityGroupMemberships:
        - name: test-sg-1
    publicIPv4Address:
      static:
        publicIPRef: my-public-ip
$ kubectl apply -f vm.yaml
virtualmachine.compute.evroclabs.net/myvm created
Note: If creating a VM with GPUs, see also the page on GPU VMs here.
Note: If you want to use custom cloud-init, follow the docs.
List Virtual Machines
$ kubectl get evvm -n customer-test
NAME   READY   REASON   VIRTUALMACHINESTATUS   IP          PUBLIC IP
myvm   True    Ready    Running                10.0.0.2    203.0.113.10
Get Detailed VM Information
$ kubectl describe evvm myvm -n customer-test
Name:         myvm
Namespace:    customer-test
...
Status:
  Conditions:
    Last Transition Time:  2024-03-14T10:05:00Z
    Status:               True
    Type:                 Ready
  Networking:
    Private IPv4 Address:  10.0.0.2
    Public IPv4 Address:   203.0.113.10
  Virtual Machine Status:  Running
...
Updating VM Information
Because Kubernetes is declarative there is nothing stopping you updating a VM spec, however:
- Changing a boot Disk is unsupported.
 - Changing the VM Virtual resources profile is unsupported.
 - Adding / removing SSH public keys is unsupported.
 - Adding or changing cloudinit configuration is unsupported.
 
In other words, while the new desired spec will be accepted, the underlying VM will continue using the old configuration.
The following fields can be changed on an update:
- Changing a VM from 'Stopped' to 'Started' (/ vice versa) is supported.
 - Adding and removing a public IP is supported.
 - Adding or removing a storage Disk is supported (but the underlying VM will only update once it has been stop-started).
 - Adding or removing a VM from a security group
 
Updating a VM's placement group
To switch the VM from being in one placement group to another, you must first stop your virtual machine, then change the placement group field and restart your virtual machine.