Home > Storage > PowerStore > Virtualization and Cloud > Dell PowerStore: VMware vSphere with Tanzu and TKG Clusters > Adding, limiting, and removing storage in a vSphere Namespace
Some applications do not maintain stateful, or persistent data therefore they have no need for persistent volumes in vSphere with Tanzu. This was demonstrated with the hello-kubernetes application in a previous section. However, most applications maintain stateful data of some type and will need persistent storage in vSphere with Tanzu. This section will outline the steps for adding storage in a vSphere Namespace and setting limits on storage consumption.
Before a DevOps team can request persistent storage through a persistent volume claim, storage that meets the requirements needs to be added to the vSphere Namespace. To add storage to a vSphere Namespace, follow these steps:
After following the previous steps, the Storage Policies should be visible in the vSphere UI.
A logged-in DevOps user is also able to see the same Storage Policies available as storage classes using the Kubernetes CLI Tools.
C:\>kubectl vsphere login --server=https://xxx.xxx.xxx.193 --vsphere-username devops@vsphere.local --insecure-skip-tls-verify
Password:
Logged in successfully.
You have access to the following contexts:
xxx.xxx.xxx.193
devops
If the context you wish to use is not in this list, you may need to try
logging in again later, or contact your cluster administrator.
To change context, use `kubectl config use-context <workload name>`
C:\>kubectl config use-context devops
Switched to context "devops".
C:\>kubectl get storageclass
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
vk8s-block-silver csi.vsphere.vmware.com Delete Immediate true 11m
vk8s-nfs-silver csi.vsphere.vmware.com Delete Immediate true 21h
vk8s-vvol-silver csi.vsphere.vmware.com Delete Immediate true 11m
Using the kubectl describe storageclass command, more information is displayed about each storage class including the CSI driver. Note in the following example and throughout this document, the vSphere CSI driver is used.
C:\>kubectl describe storageclass
Name: vk8s-block-silver
IsDefaultClass: No
Annotations: cns.vmware.com/StoragePoolTypeHint=cns.vmware.com/VMFS
Provisioner: csi.vsphere.vmware.com
Parameters: storagePolicyID=475fdecf-f339-4f99-9013-87edd1ab6cdb
AllowVolumeExpansion: True
MountOptions: <none>
ReclaimPolicy: Delete
VolumeBindingMode: Immediate
Events: <none>
Name: vk8s-nfs-silver
IsDefaultClass: No
Annotations: cns.vmware.com/StoragePoolTypeHint=cns.vmware.com/NFS
Provisioner: csi.vsphere.vmware.com
Parameters: storagePolicyID=716b2ccb-ea39-42e9-8321-545b47f1102e
AllowVolumeExpansion: True
MountOptions: <none>
ReclaimPolicy: Delete
VolumeBindingMode: Immediate
Events: <none>
Name: vk8s-vvol-silver
IsDefaultClass: No
Annotations: cns.vmware.com/StoragePoolTypeHint=cns.vmware.com/VVOL
Provisioner: csi.vsphere.vmware.com
Parameters: storagePolicyID=85e93f9f-ed1c-43ad-9263-0b6395e39b75
AllowVolumeExpansion: True
MountOptions: <none>
ReclaimPolicy: Delete
VolumeBindingMode: Immediate
Events: <none>
A vSphere Namespace is backed by a resource pool which as the ability to control resource consumption within the namespace. Typical resource limiting might be applied to CPU and memory consumption across all the vSphere Pods in the vSphere Namespace. However, limits can be applied to persistent storage as well.
To add global storage limit to a vSphere Namespace, follow these steps:
After following the previous steps, the storage limit should be visible in the vSphere UI.
Using the kubectl describe namespace command, the same 50 GB storage limit is visible as a 50Gi hard storage quota.
C:\>kubectl describe namespace devops
Name: devops
Labels: vSphereClusterID=domain-c8
Annotations: ls_id-0: cea4a565-dfc7-4ee2-a79c-137f9723a86c
ncp/extpoolid: domain-c8:c2fdf804-b0a0-4bcb-99be-9dab04afa64f-ippool-100-88-145-225-100-88-145-254
ncp/router_id: t1_556a87e1-2308-4992-8418-1445bd1b4dd5_rtr
ncp/snat_ip: xxx.xxx.xxx.227
ncp/subnet-0: 10.244.0.32/28
vmware-system-resource-pool: resgroup-3033
vmware-system-resource-pool-cpu-limit:
vmware-system-resource-pool-memory-limit:
vmware-system-vm-folder: group-v3034
Status: Active
Resource Quotas
Name: devops
Resource Used Hard
-------- --- ---
requests.storage 0 50Gi
Name: devops-storagequota
Resource Used Hard
-------- --- ---
vk8s-block-silver.storageclass.storage.k8s.io/requests.storage 0 9223372036854775807
vk8s-nfs-silver.storageclass.storage.k8s.io/requests.storage 0 9223372036854775807
vk8s-vvol-silver.storageclass.storage.k8s.io/requests.storage 0 9223372036854775807
No LimitRange resource.
To add individual per storage limits to a vSphere Namespace, follow these steps:
After following the previous steps, the storage limit should be visible in the vSphere UI. Note the global limit of 50 GB from the previous steps is also still applied to the vSphere Namespace.
Using the kubectl describe namespace command, the same 50 GB global storage limit is visible as well as the 20 GB and 10 GB individual per storage limits for block and vVol respectively.
C:\>kubectl describe namespace devops
Name: devops
Labels: vSphereClusterID=domain-c8
Annotations: ls_id-0: cea4a565-dfc7-4ee2-a79c-137f9723a86c
ncp/extpoolid: domain-c8:c2fdf804-b0a0-4bcb-99be-9dab04afa64f-ippool-100-88-145-225-100-88-145-254
ncp/router_id: t1_556a87e1-2308-4992-8418-1445bd1b4dd5_rtr
ncp/snat_ip: xxx.xxx.xxx.227
ncp/subnet-0: 10.244.0.32/28
vmware-system-resource-pool: resgroup-3033
vmware-system-resource-pool-cpu-limit:
vmware-system-resource-pool-memory-limit:
vmware-system-vm-folder: group-v3034
Status: Active
Resource Quotas
Name: devops
Resource Used Hard
-------- --- ---
requests.storage 0 50Gi
Name: devops-storagequota
Resource Used Hard
-------- --- ---
vk8s-block-silver.storageclass.storage.k8s.io/requests.storage 0 20Gi
vk8s-nfs-silver.storageclass.storage.k8s.io/requests.storage 0 9223372036854775807
vk8s-vvol-silver.storageclass.storage.k8s.io/requests.storage 0 10Gi
No LimitRange resource.
When a storage class is no longer in use or needed, it can be removed from the vSphere Namespace. To remove storage from a vSphere Namespace, follow these steps:
After following the previous steps, two Storage Policies have been removed and one storage Policy remains. The storage limits added in previous step remain in place.