Storage Policy Based Management (SPBM) is a highly customizable framework within vCenter that enables users to have virtual machines, containers and persisent volumes used with containers automatically placed on a desired storage 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 or exclude. 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 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, image registries and during the Workload Management enablement procedure within vCenter. In this section we will walk through a couple of simple examples to show how to setup vVols for use with Cloud Native Storage (CNS).
The first step is to create a vVols datastore on the target vCenter. Setting up vVols on the FlashArray with the vSphere Plugin is straight forward and easily accomplished. The procedure to register VASA can be found at this link and how to mount a vVols datastore can be found here.
VMware vVols are different from VMFS from an SPBM perspective as vVols can import information and capabilities directly from the underlying FlashArray, while VMFS does not. Therefore, more granular array-based policies may be used for vVols-based SPBM.
With that being said, a vVol datastore can optionally be tagged within vCenter via the following procedure if using vCenter-based tagging is desired. This first section will cover how create a vSphere Category and Tag first below.
Creating Categories and Tags in vSphere for vVols (Optional)
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.
Next, right-click on the vVols 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.
Creating an SPBM Policy for vVols
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 you want to use (if using Linked-Mode) and then provide a Name for the SPBM policy.
A key differentiator for using vVols with SPBM instead of VMFS is that vVols enables directly imports information and available capabilities from the underlying FlashArray which can then be included or excluded for a given policy. To use this, select the Enable rules for "com.purestorage.story.policy" storage option and then click Next.
Probably the simplest rule to implement is to only allow VMs and persistent volumes using this policy to be placed on a FlashArray. This is shown in the below Placement tab example. An optional additional rule can be added here if desired to force VMs and persistent volumes to a specific FlashArray registered against the vCenter instance with the Pure Storage vSphere plugin.
Under the Replication tab we can see that there are a multitude of rules that can be used to craft a policy specific to features like whether replication is enabled, repilcation interval as well as local snapshot Protection Groups on the FlashArray. Multiple rules can be added by using the Add Rule button.
Lastly if a vVol datastore has a tag assigned to it from vCenter as shown in the first section of this KB, tag-based placement rules can be setup by selecting the Tags tab and selecting the appropriate tag. Note that using Tags is completely optional for building SPBM with vVols.
In the below example we can see that a single vVol datastore meets the criteria we set in the previous steps. If this is as desired, click on the Next button, if it is not then adjust the policy rules accordingly from the previous step.
Review and select Finish to create the SPBM policy.