To be able to self-service VMs in vSphere with Tanzu, DevOps users must have access to VM classes. A VM class is a template that defines CPU, memory, and reservations for VMs. The VM class helps to set guardrails for the policy and governance of VMs by anticipating development needs and accounting for resource availability and constraints.

vSphere with Tanzu offers several default VM classes. A vSphere administrator can use them as is or create custom VM classes. To make the classes available to the DevOps users, the vSphere administrator adds them to a namespace. The VM classes assigned to the namespace can be used by stand-alone VMs and by the VMs that make up Tanzu Kubernetes Grid clusters.

Create a Custom VM Class in vSphere with Tanzu

As a vSphere administrator, you can use available default classes. You can also create custom VM classes instead of the default and use them for VM deployment in a namespace.

When you create new classes, keep in mind the following considerations.
  • VM classes that you create in a vCenter Server instance are available to all vCenter Server clusters and all namespaces in these clusters.
  • VM classes are available to all namespaces in vCenter Server. However, DevOps engineers can use only those VM classes that you associate with a particular namespace.

Prerequisites

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

Procedure

  1. Go to the VM Service page.
    1. From the vSphere Client home menu, select Workload Management.
    2. Click the Services tab and click Manage on the VM Service pane.
  2. On the VM Service page, click VM Classes and click Create VM Class.
  3. On the Configuration page, specify the general VM class attributes.
    VM Class Attribute Description
    Name Identifies the VM class. Enter a unique DNS compliant name that follows these requirements:
    • Use a unique name that does not duplicate the names of default or custom VM classes in your environment.
    • Use alphanumeric string with maximum length of 63 characters.
    • Do not use uppercase letters or spaces.
    • Use a dash anywhere except as a first or last character. For example, vm-class1.
    After you create the VM class, you cannot change its name.
    vCPU Count Defines the number of virtual CPUs (vCPUs) for a VM. This is a VM hardware configuration. When a DevOps user assigns the VM class to a VM, this count becomes the configured number of vCPUs for the VM.
    CPU Resource Reservation Optional parameter. Specifies the guaranteed minimum CPU resource allocation for a virtual machine. This value is expressed in percentage (%). Value of 0 % defines no CPU reservation.

    The percentage you enter is multiplied by the minimum CPU available among all the cluster nodes. The resulting value, in MHz, specifies the amount of CPU resources that vSphere guarantees for a VM.

    Memory Defines the memory configured for a VM in MB, GB, or TB. This is a VM hardware configuration. When a DevOps user assigns the VM class policy to a VM, the VM receives the amount of memory defined by this attribute.

    The value must be between 4 MB and 24 TB and a multiple of 4 MB.

    Memory Resource Reservation Optional parameter. Defines the reserved amount of memory that is configured for a VM. The value of the attribute ranges between 0 and 100%.

    If you add PCI devices to the VM class configuration, set the parameter to 100%.

  4. (Optional) Add advanced configuration.
    Option Description
    PCI Devices If ESXi hosts in your vSphere with Tanzu environment have one or more NVIDIA GRID GPU graphics devices, you can configure VMs to use the NVIDIA GRID virtual GPU (vGPU) technology. You can also configure other PCI devices on an ESXi host to make them available to a VM in a passthrough mode.

    If you select this option, the memory resource reservation value automatically changes to 100%.

    For requirements and additional details, see Add PCI Devices to a VM Class in vSphere with Tanzu.

    Instance Storage Along with persistent storage volumes, a VM can use instance storage. Unlike persistent volumes that exist separately from the VM, instance storage volumes depend on the lifecycle of a VM instance.

    Using the Instance Storage option, you can add appropriate storage policies and configure volumes to be used with the VM.

    For additional requirements, see Deploying a VM with Instance Storage in vSphere with Tanzu.

  5. On the Review and Confirm page, review the details and click Finish.

Edit or Delete a VM Class in vSphere with Tanzu

After you create a VM class, you can edit its parameters. You can also edit default VM classes that vSphere with Tanzu offers. If you no longer need an existing VM class, you can delete it from your environment.

Editing a VM class does not result in automatic reconfiguring of the VMs that were previously deployed from this class. For example, if a DevOps user created a Tanzu Kubernetes Grid cluster with the VM class and you later change the VM class definition, existing Tanzu Kubernetes Grid VMs remain unaffected. New Tanzu Kubernetes Grid VMs will use the modified class definition.
Caution: If you scale out a Tanzu Kubernetes Grid cluster after editing a VM class used by that cluster, new cluster nodes use the updated class definition, but existing cluster nodes continue to use the initial class definition, resulting in a mismatch. Both control plane and worker nodes can be scaled. For information about scaling, see Scale a Workload Cluster in the Using Tanzu Kubernetes Grid 2 with vSphere with Tanzu.

When you delete a VM class, it is removed from all associated namespaces. DevOps users can no longer self-service VMs using this VM class. VMs that have already been created with this VM class are not affected.

Prerequisites

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

Procedure

  1. In the vSphere Client, display available VM classes.
    1. From the vSphere Client home menu, select Workload Management.
    2. Click the Services tab and click the VM Service pane.
    3. On the VM Service page, click VM Classes.
      All default or user-created VM classes appear under Available VM Classes.
  2. Edit or delete an existing VM class.
    Option Description
    Edit a VM class
    1. In the selected VM class pane, click Manage and click Edit.
    2. Modify the VM class parameters.
      Note: You cannot change the name of the VM class.
    Delete a VM class
    1. In the selected VM class pane, click Manage and click Delete.
    2. Confirm that you want to delete the VM class.

Associate a VM Class with a Namespace in vSphere with Tanzu

As a vSphere administrator, add a default or custom VM class to one or more namespaces on a Supervisor. When you add a VM class to a namespace, you make the class available to DevOps users, so that they can start self-servicing VMs in the Kubernetes namespace environment. The VM classes you assign to the namespace are also used by the VMs that make up Tanzu Kubernetes Grid clusters.

You can add multiple VM classes to a single namespace. Different VM classes serve as indicators of different levels of service. If you publish multiple VM classes, DevOps users can select between all custom and default classes when creating and managing virtual machines in the namespace.

Note:

To be able to deploy a Tanzu Kubernetes Grid cluster in a newly created namespace, DevOps engineers need to have access to VM classes. As a vSphere administrator, you must explicitly associate default or custom VM classes to any new namespace where the Tanzu Kubernetes Grid cluster is deployed.

Prerequisites

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

Procedure

  1. In the vSphere Client, go to the namespace.
    1. From the vSphere Client home menu, select Workload Management.
    2. Click the Namespaces tab and click the namespace.
  2. Add a VM class.
    1. On the VM Service pane, click Add VM Class.
    2. Select one or several VM classes and click OK.

Results

The VM classes you added become available in the namespace for the DevOps to self-service VMs. These classes can also be used by the VMs that make up Tanzu Kubernetes Grid clusters.

Manage VM Classes on a Namespace in vSphere with Tanzu

After you associate a VM class with a namespace, you can add more VM classes or remove the class to unpublish it from the Kubernetes namespace.

Prerequisites

  • If you want to remove a VM class from a namespace, verify that it is not used by Tanzu Kubernetes Grid. Removing it can affect operations Tanzu Kubernetes Grid.
  • Required privileges:
    • Namespaces.Modify cluster-wide configuration
    • Namespaces.Modify namespace configuration
    • Virtual Machine Classes.Manage Virtual Machine Classes

Procedure

  1. In the vSphere Client, go to the namespace.
    1. From the vSphere Client home menu, select Workload Management.
    2. Click the Namespaces tab and click the namespace.
  2. Add or remove a VM class.
    1. On the VM Service pane, click Manage VM Class.
    2. Perform one of the following operations.
      Option Description
      Remove a VM class Deselect the VM class and click OK.
      Add a VM class Select one or several VM classes and click OK.