Documentation
Set Up vSphere CNS and Create a Storage Policy in vSphere ΒΆ
vSphere administrators can set up vSphere CNS and create storage policies for virtual disk (VMDK) storage, based on the needs of workload cluster users.
You can use either vSAN or local VMFS (Virtual Machine File System) for persistent storage in a Kubernetes cluster, as follows:
vSAN Storage:
To create a storage policy for vSAN storage in the vSphere Client, browse to Home > Policies and Profiles > VM Storage Policies and click Create to launch the Create VM Storage Policy wizard.
Follow the instructions in Create a Storage Policy in the vSphere documentation. Make sure to:
- In the Policy structure pane, under Datastore specific rules, select Enable rules for “vSAN” storage.
- Configure other panes or accept defaults as needed.
- Record the storage policy name for reference as the
storagePolicyName
value inStorageClass
objects.
Local VMFS Storage:
To create a storage policy for local storage, apply a tag to the storage and create a storage policy based on the tag as follows:
From the top-level vSphere menu, select Tags & Custom Attributes
In the Tags pane, select Categories and click New.
Enter a category name, such as
tkg-storage
. Use the checkboxes to associate it with Datacenter and the storage objects, Folder and Datastore. Click Create.From the top-level Storage view, select your VMFS volume, and in its Summary pane, click Tags > Assign….
From the Assign Tag popup, click Add Tag.
From the Create Tag popup, give the tag a name, such as
tkg-storage-ds1
and assign it the Category you created. Click OK.From Assign Tag, select the tag and click Assign.
From top-level vSphere, select VM Storage Policies > Create a Storage Policy. A configuration wizard starts.
In the Name and description pane, enter a name for your storage policy. Record the storage policy name for reference as the
storagePolicyName
value inStorageClass
objects.In the Policy structure pane, under Datastore specific rules, select Enable tag-based placement rules.
In the Tag based placement pane, click Add Tag Rule and configure:
- Tag category: Select your category name
- Usage option:
Use storage tagged with
- Tags: Browse and select your tag name
Confirm and configure other panes or accept defaults as needed, then click Review and finish. Finish to create the storage policy.