Virtual Machines in
vSphere Supervisor
Last Updated December 16, 2024

vSphere Supervisor
offers the VM Service functionality to enable DevOps engineers to provision and manage VMs on a namespace in a self-service manner. You use the
vSphere Supervisor
automation APIs to create VM classes that specify the deployment policy and resource reservations of such VMs.
Starting with vSphere 7.0 Update 2a, DevOps engineers can use the VM Service functionality to deploy and run VMs on a namespace through the
kubectl
commands. You can use the
vSphere Supervisor
automation APIs to manage the two VM Service components: VM classes and content libraries. For more information about managing content libraries in the context of
vSphere Supervisor
, see Content Libraries in vSphere Supervisor.
You can use the automation APIs to create and manage VM classes. A VM class specification defines the number of CPUs, memory capacity, and resource reservation settings of the desired virtual machine.
vSphere Supervisor
currently offers twelve ready-to-use VM classes (T-shirt sizes) that are derived from the most popular VMs in Kubernetes. Based on the resource reservation that a VM specification requests, each predefined VM class has two editions: guaranteed and best effort. The guaranteed VM class fully reserves the configured resources. A best effort VM class does not guarantee any resource reservations and allows their overcommitment.
You associate a VM class with a specific namespace to make it available to the DevOps engineers who have access to that namespace. You can assign any number of existing VM classes or create a custom one. Note that VMs deployed by the DevOps engineers through the VM Service can only be managed with the
kubectl
commands. A VM provisioned by DevOps engineers shares the same resources in a namespace as containers.
Use the
VirtualMachineClasses
interface to create and manage a specification of a VM class object. Through these objects you predefine the number of CPUs, memory capacity, and reservation settings. See Create a VM Class in vSphere Supervisor. To make a VM class available to the DevOps engineers for self-service VM deployment, you must associate it with a specific namespace. See Associating a VM Class with a vSphere Namespace.

Create a VM Class in
vSphere Supervisor

You can use the
vSphere Automation
Kubernetes APIs to create custom VM classes to be used for VM deployment in
vSphere Supervisor
.
Required privileges:
  • Namespaces
    Modify cluster-wide configuration
  • Namespaces
    Modify namespace configuration
  • Virtual Machine Classes
    Manage Virtual Machine Classes
A VM class specifies the CPU, memory, and resource reservations for a VM.
vSphere Supervisor
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.
  1. Create the specification of the VM class object by defining the following options.
    Option
    Description
    setId(String 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.
    setCpuCount(long cpuCount)
    The number of virtual CPUs (vCPUs) configured for a VM that are deployed with this VM class.
    setMemoryMB(long memoryMB)
    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.
    setDescription(String description)
    Optional. The description of the VM class.
    setCpuReservation(Long cpuReservation)
    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.
    setMemoryReservation(Long memoryReservation)
    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.
    Call the
    create(VirtualMachineClassesTypes.CreateSpec spec)
    method of the
    VirtualMachineClasses
    interface and pass as argument the created VM class specification.
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.

Editing or Removing a VM Class from Your Environment

You can use the automation APIs to edit the configuration of a VM class that you created or a predefined VM classes that
vSphere Supervisor
offers. When you no longer need an existing VM class, you can remove it from your
vCenter Server
instance.
Note that editing a VM class specification does not affect the VMs that are already deployed by the DevOps engineers from this class. Only newly deployed VMs will use the reconfigured VM class.
Deleting a VM class results in its removal from all related namespaces. All VMs deployed with this VM class remain unchanged but DevOps engineers can no longer use it.
You can list all VM classes available for a
vCenter Server
instance
by calling the
list
method of the
VirtualMachineClasses
interface.
You receive a list of all VM classes and a detailed information about each one of them. Based on the detailed information, you can narrow the list and retrieve the IDs of the VM classes that you want to edit or delete.
To edit a VM class configuration,
call the
update(String vmClass, VirtualMachineClassesTypes.UpdateSpec spec)
method of the
VirtualMachineClasses
interface and pass as arguments the VM class ID and the update specification.
You can edit all VM class attributes except the ID of the class. Only the attributes modified within the update specification will be edited.
To delete a VM class from your environment,
call the
delete(java.lang.String vmClass)
method of the
VirtualMachineClasses
interface and pass the ID of the class as argument.

Associating a VM Class with a
vSphere Namespace

You must associate a VM class with a namespace to make it available for DevOps engineers to deploy VMs in a self-service manner.
You can associate one or more VM classes with a single namespace or you can add one VM class to several namespaces. You can use the predefined VM classes that
vSphere Supervisor
provides or you can create custom ones. See Create a VM Class in vSphere Supervisor.
Since VM Service is the feature responsible for handling VM classes, you must make that service aware of the VM classes available to the engineers using a specific namespace. You can achieve this when you create a new namespace or edit an existing one. See Managing Namespaces on a Supervisor.
When you create the VM Service specification set the list of VM classes that must be used to create VMs on the specific namespace. You achieve this by
calling the
setVmClasses(java.util.Set<java.lang.String> vmClasses)
method of the
VirtualMachineClasses
object.
You can also associate one or more content libraries with a namespace that has the VM Service enabled. See Associating a Content Library with a Namespace.