apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: example-vm
namespace: example-namespace
spec:
dataVolumeTemplates:
- metadata:
name: example-vm-volume
spec:
sourceRef:
kind: DataSource
name: rhel9
namespace: openshift-virtualization-os-images
storage:
resources: {}
instancetype:
name: u1.medium
preference:
name: rhel.9
running: true
template:
spec:
domain:
devices: {}
volumes:
- dataVolume:
name: example-vm-volume
name: rootdisk
- cloudInitNoCloud: (1)
userData: |-
#cloud-config
runcmd:
- [ setsebool, -P, virt_qemu_ga_manage_ssh, on ]
name: cloudinitdisk
accessCredentials:
- sshPublicKey:
propagationMethod:
qemuGuestAgent:
users: ["cloud-user"]
source:
secret:
secretName: authorized-keys (2)
---
apiVersion: v1
kind: secret
metadata:
name: authorized-keys
data:
key: c3NoLXJzYSB... (3)