Skip to content

Commit

Permalink
creating-vm-cli manifest example - new
Browse files Browse the repository at this point in the history
  • Loading branch information
ousleyp committed May 2, 2024
1 parent d173a13 commit 1db9c3b
Showing 1 changed file with 30 additions and 68 deletions.
98 changes: 30 additions & 68 deletions modules/virt-creating-vm-cli.adoc
Expand Up @@ -14,81 +14,43 @@ You can create a virtual machine (VM) from a `VirtualMachine` manifest.
+
.Example manifest for a {op-system-base} VM
[source,yaml]
[%collapsible]
====
----
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
labels:
app: <vm_name> <1>
name: <vm_name>
spec:
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: rhel-9-minimal
spec:
dataVolumeTemplates:
- apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
name: <vm_name>
spec:
sourceRef:
kind: DataSource
name: rhel9 <2>
namespace: openshift-virtualization-os-images
storage:
resources:
requests:
storage: 30Gi
running: false
- metadata:
name: rhel-9-minimal-volume
spec:
sourceRef:
kind: DataSource
name: rhel9 <1>
namespace: openshift-virtualization-os-images <2>
storage: {}
instancetype:
name: u1.medium <3>
preference:
name: rhel.9 <4>
running: true
template:
metadata:
labels:
kubevirt.io/domain: <vm_name>
spec:
domain:
cpu:
cores: 1
sockets: 2
threads: 1
devices:
disks:
- disk:
bus: virtio
name: rootdisk
- disk:
bus: virtio
name: cloudinitdisk
interfaces:
- masquerade: {}
name: default
rng: {}
features:
smm:
enabled: true
firmware:
bootloader:
efi: {}
resources:
requests:
memory: 8Gi
evictionStrategy: LiveMigrate
networks:
- name: default
pod: {}
devices: {}
volumes:
- dataVolume:
name: <vm_name>
name: rootdisk
- cloudInitNoCloud:
userData: |-
#cloud-config
user: cloud-user
password: '<password>' <3>
chpasswd: { expire: False }
name: cloudinitdisk
- dataVolume:
name: rhel-9-minimal-volume
name: rootdisk
----
<1> Specify the name of the virtual machine.
<2> Specify the name in the `spec.dataImportCronTemplate.spec.managedDataSource` field in the `Hyperconvered` CR.
<3> Specify the password for cloud-user.
<1> The `rhel9` golden image is used to install {op-system-base} 9 as the guest operating system.
<2> Golden images are stored in the `openshift-virtualization-os-images` namespace.
<3> The `u1.medium` instance type requests 1 vCPU and 4Gi memory for the VM. These resource values cannot be overridden within the VM.
<4> The `rhel.9` preference specifies additional attributes that support the {op-system-base} 9 guest operating system.
+
[NOTE]
====
The `spec.dataVolumeTemplates.spec.sourceRef.name` value in the `VirtualMachine` manifest must match the value of `spec.dataImportCronTemplates.spec.managedDataSource` in the `HyperConverged` CR.
====
. Create a virtual machine by using the manifest file:
Expand Down

0 comments on commit 1db9c3b

Please sign in to comment.