Cloud Native Storage is in everyone’s heads at the latest after VMworld. However, many are of the opinion that VMware CNS would only run on vSAN storage. But that’s wrong.
This article will show how Cloud Native Storage can be operated with VMFS or NFS storage.
Storage Tag and Policy
The first thing to do is to create a storage tag. To do this, click on Menu in vSphere Client and then on Tags & Custom Attributes.
Under Tags & Custom Attributes, select NEW and give the tag to be created a name. If necessary, create a new category or select an existing one. In my case “vb-k8s-lab” and the new category “Storage”
Now switch to the Storage view and select a VMFS or NFS storage to be used by Cloud Native Storage. Click here under Tags Assign and select the newly created tag.
The next step is to create a storage policy. Simply click on Policies and Profiles in the Web Client menu.
Switch to Policies and Profiles in VM Storage Policies and click Create VM Storage Policy.
The new storage policy needs a name that will be addressed by Kubernetes in the same way later.
For the policy structure, Enable tag based placement rules must be selected.
Now the created tag is selected via Tag category and Browse Tags
The next page shows all the storages matching the selected Tag(s).
Finally, check the settings and click Finish.
Create vSphere User
In order that kubernetes can access the new configures storage, a user with the following roles/rights must be created.
|CNS-SPBM||Profile-Driven Storage |
> Profile-driven storage update
> Profile-driven storage view
|ROOT – vCenter Server|
no propagate to children
|CNS-VM||Virtual Machine – Change Configuration|
> Add existing disk
> Add or remove device
|All cluster node VMs|
> Low level file operations
|Read-Only||All Hosts on which cluster node VMs running and|
|ROOT – vCenter Server|
with propagate to children
Now that the policies have been created, a StorageClass can be created in Kubernetes.
Using the vSphere Container Storage Interface driver, Kubernetes can point to the Storage Polices.
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: filesystem-xfs annotations: storageclass.kubernetes.io/is-default-class: "false" provisioner: csi.vsphere.vmware.com parameters: fstype: xfs storagepolicyname: k8s-lab
Now that all requirements are met, Kubernetes can provision storage and attach VMs to each node.
In the vSphere Web Client this will look like this:
If Kubernetes uses multiple labels, they can be displayed via SEE ALL. A big advantage of Cloud Native Storage is that the vSphere WebClient now displays information that was previously only available in the Kubernetes cluster.