Live ubuntu
Running the ubuntu live vm
Here's the working example of an ubuntu VM with cloud-init, added SSH key and emptyDir scratch disk:
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: myvm
spec:
running: false
template:
spec:
accessCredentials:
- sshPublicKey:
propagationMethod:
configDrive: {}
source:
secret:
secretName: pub-keys
architecture: amd64
domain:
cpu:
cores: 8
devices:
autoattachGraphicsDevice: true
autoattachSerialConsole: true
disks:
- disk:
bus: virtio
name: harddrive
- disk:
bus: virtio
name: virtiocontainerdisk
bootOrder: 1
- disk:
bus: virtio
name: cloudinit
machine:
type: q35
resources:
limits:
cpu: 800m
memory: 8Gi
requests:
cpu: 800m
memory: 8Gi
volumes:
- containerDisk:
image: quay.io/containerdisks/ubuntu:22.04
name: virtiocontainerdisk
- emptyDisk:
capacity: 16Gi
name: harddrive
- cloudInitConfigDrive:
userData: |-
#cloud-config
disk_setup:
/dev/vda:
table_type: gpt
layout: True
overwrite: True
fs_setup:
- device: /dev/vda
partition: 1
filesystem: xfs
mounts:
- [ vda, /opt/data ]
name: cloudinit
You also need to create the secret with your SSH key to login with:
Use virtctl to start the VM:
Open VNC or SSH:
Example of an ubuntu vm with large local disk on linstor
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: ubuntu-vm
spec:
dataVolumeTemplates:
- metadata:
name: ubuntu-2204
spec:
source:
registry:
url: "docker://quay.io/containerdisks/ubuntu:22.04"
pvc:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 150Gi
storageClassName: linstor-igrok
running: true
template:
metadata:
creationTimestamp: null
spec:
accessCredentials:
- sshPublicKey:
source:
secret:
secretName: pub-keys
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/region
operator: In
values:
- us-west
- key: nautilus.io/linstor
operator: In
values:
- "true"
architecture: amd64
domain:
cpu:
cores: 8
devices:
autoattachGraphicsDevice: true
autoattachSerialConsole: true
disks:
- bootOrder: 1
disk:
bus: virtio
name: datavolumedisk1
machine:
type: q35
resources:
limits:
ephemeral-storage: 100Gi
memory: 3Gi
requests:
ephemeral-storage: 100Gi
memory: 3Gi
volumes:
- dataVolume:
name: ubuntu-2204
name: datavolumedisk1
- cloudInitConfigDrive:
userData: |-
#cloud-config
name: cloudinit