mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
85 lines
3.1 KiB
Plaintext
85 lines
3.1 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * virt/virtual_machines/creating_vm/virt-creating-vms-from-instance-types.adoc
|
|
|
|
:_mod-docs-content-type: CONCEPT
|
|
[id="virt-about-instance-types_{context}"]
|
|
= About instance types
|
|
|
|
An instance type is a reusable object where you can define resources and characteristics to apply to new VMs. You can define custom instance types or use the variety that are included when you install {VirtProductName}.
|
|
|
|
To create a new instance type, you must first create a manifest, either manually or by using the `virtctl` CLI tool. You then create the instance type object by applying the manifest to your cluster.
|
|
|
|
{VirtProductName} provides two CRDs for configuring instance types:
|
|
|
|
* A namespaced object: `VirtualMachineInstancetype`
|
|
* A cluster-wide object: `VirtualMachineClusterInstancetype`
|
|
|
|
These objects use the same `VirtualMachineInstancetypeSpec`.
|
|
|
|
[id="required-attributes_{context}"]
|
|
== Required attributes
|
|
|
|
When you configure an instance type, you must define the `cpu` and `memory` attributes. Other attributes are optional.
|
|
|
|
[NOTE]
|
|
====
|
|
When you create a VM from an instance type, you cannot override any parameters defined in the instance type.
|
|
|
|
Because instance types require defined CPU and memory attributes, {VirtProductName} always rejects additional requests for these resources when creating a VM from an instance type.
|
|
====
|
|
|
|
You can manually create an instance type manifest. For example:
|
|
|
|
.Example YAML file with required fields
|
|
[source,yaml]
|
|
----
|
|
apiVersion: instancetype.kubevirt.io/v1beta1
|
|
kind: VirtualMachineInstancetype
|
|
metadata:
|
|
name: example-instancetype
|
|
spec:
|
|
cpu:
|
|
guest: 1 <1>
|
|
memory:
|
|
guest: 128Mi <2>
|
|
----
|
|
<1> Required. Specifies the number of vCPUs to allocate to the guest.
|
|
<2> Required. Specifies an amount of memory to allocate to the guest.
|
|
|
|
You can create an instance type manifest by using the `virtctl` CLI utility. For example:
|
|
|
|
.Example `virtctl` command with required fields
|
|
[source,terminal]
|
|
----
|
|
$ virtctl create instancetype --cpu 2 --memory 256Mi
|
|
----
|
|
|
|
where:
|
|
|
|
`--cpu <value>`:: Specifies the number of vCPUs to allocate to the guest. Required.
|
|
`--memory <value>`:: Specifies an amount of memory to allocate to the guest. Required.
|
|
|
|
[TIP]
|
|
====
|
|
You can immediately create the object from the new manifest by running the following command:
|
|
|
|
[source,terminal]
|
|
----
|
|
$ virtctl create instancetype --cpu 2 --memory 256Mi | oc apply -f -
|
|
----
|
|
====
|
|
|
|
[id="optional-attributes_{context}"]
|
|
== Optional attributes
|
|
|
|
In addition to the required `cpu` and `memory` attributes, you can include the following optional attributes in the `VirtualMachineInstancetypeSpec`:
|
|
|
|
`annotations`:: List annotations to apply to the VM.
|
|
`gpus`:: List vGPUs for passthrough.
|
|
`hostDevices`:: List host devices for passthrough.
|
|
`ioThreadsPolicy`:: Define an IO threads policy for managing dedicated disk access.
|
|
`launchSecurity`:: Configure Secure Encrypted Virtualization (SEV).
|
|
`nodeSelector`:: Specify node selectors to control the nodes where this VM is scheduled.
|
|
`schedulerName`:: Define a custom scheduler to use for this VM instead of the default scheduler.
|