You can use the vSphere Automation Kubernetes REST APIs to create custom VM classes to be used for VM deployment in vSphere with Tanzu.

A VM class specifies the CPU, memory, and resource reservations for a VM. vSphere with Tanzu offers several preconfigured VM classes which you can use as is, edit, or delete. You can also create a custom VM class in your vCenter Server instance and it will be available to all Supervisors and the namespaces created in these clusters. Note that even though a VM class is available to all namespaces, a DevOps user can only use the VM classes associated with the namespaces that he/she can access.

Prerequisites

Required privileges:
  • Namespaces.Modify cluster-wide configuration
  • Namespaces.Modify namespace configuration
  • Virtual Machine Classes.Manage Virtual Machine Classes

Procedure

  1. Create the specification of the VM class object by defining the following options.
    Option Description
    id The identifier of the VM class must follow these DNS requirements:
    • A unique name in the current vCenter Server instance.
    • An alphanumeric name with maximum 63 characters.
    • No uppercase letters of spaces.
    • A dash can be used anywhere except as a first or last character.
    Note that after a VM class is created, you cannot edit its ID.
    cpu_count The number of virtual CPUs (vCPUs) configured for a VM that are deployed with this VM class.
    memory_MB The memory in MB configured for a VM that are deployed with this VM class. The value must be between 4 MB and 24 TB and a multiple of 4.
    description Optional. The description of the VM class.
    cpu_reservation Optional. The percentage of total available CPU resources reserved for the VM deployed with the VM class. The percentage you specify with this attribute is multiplied by the minimum CPU available among all cluster nodes to get the CPU resources guaranteed by vSphere for a VM. The resulting value is in MHz.
    memory_reservation Optional. The percentage of available memory that is reserved for a VM deployed with this VM class. The value can be from 0 through 100%.
  2. Create the VM class object.
    Use the POST https://<vcenter_ip_address_or_fqdn>/api/vcenter/namespace-management/virtual-machine-classes HTTP request and pass the created VM class specification in the request body.

What to do next

After you create the custom VM class, you can edit its parameters or delete it from your environment. See Editing or Removing a VM Class from Your Environment.

You can make your VM class available to DevOps engineers by associating it with a namespace. See Associating a VM Class with a vSphere Namespace.