Before you enable vSphere with Kubernetes, create storage policies to be used in the Supervisor Cluster and namespaces. The policies represent datastores available in the vSphere environment. They control the storage placement of such objects as control plane VMs, pod ephemeral disks, container images, and persistent storage volumes. If you use VMware Tanzu™ Kubernetes Grid™ Service, the storage policies also dictate how the Tanzu Kubernetes cluster nodes are deployed.

Depending on your vSphere storage environment and the needs of DevOps, you can create several storage policies to represent different classes of storage. For example, if your vSphere storage environment has three classes of datastores, Bronze, Silver, and Gold, you can create storage policies for all datastores. You can then use the Bronze datastore for ephemeral and container image virtual disks, and use the Silver and Gold datastores for persistent volume virtual disks. For more information about storage policies, see the Storage Policy Based Management chapter in the vSphere Storage documentation.

The following example creates the storage policy for the datastore tagged as Gold.

Prerequisites

  • Make sure that the datastore you reference in the storage policy is shared between all ESXi hosts in the cluster.
  • Required privileges: VM storage policies. Update and VM storage policies. View.

Procedure

  1. Add tags to the datastore.
    1. Right-click the datastore you want to tag and select Tags and Custom Attributes > Assign Tag.
    2. Click Add Tag and specify the tag's properties.
      Property Description
      Name Specify the name of the datastore tag, for example, Gold.
      Description Add the description of the tag. For example, Datastore for Kubernetes objects.
      Category Select an existing category or create a new category. For example, Storage for Kubernetes.
  2. In the vSphere Client, open the Create VM Storage Policy wizard.
    1. Click Menu > Policies and Profiles.
    2. Under Policies and Profiles, click VM Storage Policies.
    3. Click Create VM Storage Policy.
  3. Enter the policy name and description.
    Option Action
    vCenter Server Select the vCenter Server instance.
    Name Enter the name of the storage policy, for example, Gold Storage Policy.
    Description Enter the description of the storage policy.
  4. On the Policy structure page under Datastore specific rules, enable tag-based placement rules.
  5. On the Tag based placement page, create the tag rules.
    Select the options using the following example.
    Option Description
    Tag category From the drop-down menu, select the tag's category, such as Storage for Kubernetes.
    Usage option Select Use storage tagged with.
    Tags Click Browse Tags, and select the datastore tag, for example, Gold.
  6. On the Storage compatibility page, review the list of datastores that match this policy.
    In this example, only the datastore that is tagged as Gold is displayed.
  7. On the Review and finish page, review the storage policy settings and click Finish.

Results

The new storage policy for the datastore tagged as Gold appears on the list of existing storage policies.

What to do next

After creating storage policies, a vSphere administrator can perform the following tasks:
  • Assign the storage policies to the Supervisor Cluster. The storage policies configured on the Supervisor Cluster ensure that the control plane VMs, pod ephemeral disks, and container images are placed on the datastores that the policies represent. See Enable vSphere with Kubernetes on a Cluster with NSX-T Data Center.
  • Assign the storage policies to the Supervisor Namespace. Storage policies visible to the namespace determine which datastores the namespace can access and use for persistent volumes. The storage policies appear as matching Kubernetes storage classes in the namespace. They are also propagated to the Tanzu Kubernetes cluster on this namespace. DevOps engineers can use the storage classes in their persistent volume claim specifications. See Create and Configure a Supervisor Namespace.