Tanzu User Guide: Storage Policy Based Management (SPBM) with VMFS
Storage Policy Based Management (SPBM) is a highly customizable framework within vCenter that enables users to have virtual machines, containers and persistent volumes used with containers automatically placed on a desired resource via policy. Basically, it can be considered a storage abstraction layer that enables placement of data based upon what features you want the storage layer to include. This stands as a significant improvement over the traditional method of selecting an individual datastore or multiple datastores depending on use case. Examples can include vVols vs VMFS, how often or if you want a snapshot or replication policy associated with the volume or even performance-based placement to list just a few. By abstracting the storage layer in such a manner, both VMware administrators and DevOps users unchain themselves from having to map a volume/persistent volume claim to the underlying array and can instead focus on placement based upon the storage SLA they need for that particular workload.
For Kubernetes with vSphere in particular, the usage of SPBM is required as persistent volume claims, storage classes and other key constructs directly reference SPBM policies by name in YAML file deployment specifications and during the Workload Management enablement procedure itself. In this section we will walk through a couple of simple examples to show how to setup a VMFS volume for use with Workload Management.
The first step is to create a VMFS datastore on vCenter. If the VMFS on FC Principal Storage option is in use through VMware Cloud Foundation, then a VMFS datastore was created prior to the Workload Domain being commissioned. That datastore can be used with SPBM and for Workload Management. However, some customers may wish to place their Supervisor cluster on a separate datastore for different replication or retention or separation of VMs requirements.
Please follow this link for instructions on how to create a VMFS datastore via the Pure Storage vSphere plugin.
Now that a VMFS datastore has been created, the next step is to create and assign a category and tag to that datastore that we will later use to build an SPBM policy.
First, enter the Tags and Custom Attributes menu within the vSphere client.
Next, select the Categories button and then New.
Choose a descriptive Category Name, select One Tag and lastly pick Datastore and Datastore Cluster as the Object Types. Click OK to finish creating the new category.
In similar fashion as with the Category we just created, next we will add a Tag to that Category. Select the Tags option this time and then NEW.
In the Add Tag wizard, provide a descriptive Name, select the Category created in the previous step and then click OK.
Here's an example of 2 categories that have FibreChannel and iSCSI protocol tags as members.
Next, right-click on the VMFS datastore you want to use for Workload Management, select Tags & Custom Attributes then Assign Tag...
Pick the appropriate Tag you want to use and click on Assign.
We now have the necessary pieces in place to create an example SPBM policy.
To get started with that phase, click on the main vSphere menu and pick Policies and Profiles.
Select the 2nd option down, VM Storage Policies and then Create VM Storage Policy.
In the spawned wizard, first select the vCenter server from the pull down list you want to use (if using vCenter in enhanced Linked-Mode) and then provide a Name for the SPBM policy.
Under the Policy Structure section of the wizard, click on the checkbox for Enable tag based placement rules and then click Next.
In the Tag based placement window of the wizard, you need to have a minimum of one rule but you can also add additional rules depending on the level of specificity you want the policy to have. Within the context of a VMFS policy, this means you can assign multiple tags to a given datastore and include them as separate rules for granular policy creation. To keep it simple for this example, we will select a single rule and use the Tag Category and then select Browse Tags and pick the tag we assigned to the datastore earlier within this section. Click Next to proceed.
The next screen of the wizard will show the existing datastores that match the rules set in the previous screen. In our example, we have two datastores that use the tag we selected. If the datastores shown are as expected, click Next to proceed.
Lastly, review the selections made and click Finish to execute policy creation.