Managing persistent volumes in Tanzu Kubernetes Grid

How to deploy an application in Tanzu Kubernetes Grid with persistent volumes

Last updated 10th November 2022


This guide documents how to manage persistent volumes on a Tanzu Kubernetes Grid cluster.

OVHcloud provides services for which you are responsible, with regard to their configuration and management. It is therefore your responsibility to ensure that they work properly.

This guide is designed to assist you as much as possible with common tasks. However, we recommend contacting a specialist provider if you experience any difficulties or doubts when it comes to managing, using or setting up a service on a server.



Persistent volumes are used to store data permanently on a Kubernetes cluster. This mechanism is based on Storage Classes. There are various Storage Classes. Read the Kubernetes Storage Classes guide for more information.

When deploying a WorkLoad cluster, a Storage Class CSI provisioner is created and points to the Datastore folder that contains the virtual machines in the WorkLoad cluster.

From your VMware cluster, go to the inventory. Select the storage icon to the left, and go to the datastore where your WorkLoad cluster was deployed. Go to the Files tab and click the fcd folder.

The folder is empty because the WorkLoad cluster does not yet use persistent volumes.

01 Display FCD folder

You can create additional Storage Classes for each WorkLoad cluster.


We will connect to a WorkLoad cluster from the console of the Bootstrap virtual machine. You can use the Tanzu Management Cluster Grid administration guide to create and manage a workload cluster.

From the Bootstrap virtual machine console, run this command to view the contexts that can be used on this cluster:

# Display all the contexts of your TANZU KUBERNETES GRID cluster
kubectl config get-contexts

Run this command to use the WorkLoad cluster:

# Connect to WorkLoad cluster
kubectl config use-context tkgm-workload-cluster-admin@tkgm-workload-cluster

Displaying Existing Storage Classes

For information about the Storage Classes in a WorkLoad cluster, run these commands:

# Display Storage Classes
kubectl get storageclass
# Storage Class description
kubectl describe storageclass nomclasse

Creating a storage class on another datastore

On our VMware cluster, we have two datastores connected to NFS servers. One of the datastores contains the virtual machines in the WorkLoad cluster, as well as the fcd folder used by the Storage Class in the Workload cluster.

We will create a new Storage Class on the second datastore.

Go back to your VMware cluster in storage management, select the second datastore, and click Summary in the tab on the left.

Copy the URL below "Type: NFS 3".

02 Select URL01

Go to the console of the Bootstrap virtual machine, edit a new file named secondstorageclass.yaml with this content:

kind: StorageClass
  name: secondstorageclass
  annotations: "true"
  datastoreurl: "ds:///vmfs/volumes/xxxxxxxxxxxxxxxxx/"

Edit the file by replacing ds:///vmfs/volumes/xxxxxxxxxxxxxxxxx/ with the URL you just copied.

Next, run this command:

# Creating storageclass from yaml file
kubectl apply -f secondstorageclass.yaml
# Display storageclasses
kubectl get storageclass

We are now seeing two Storage Classes:

default (default)       Delete          Immediate           true                   3d18h
secondstorageclass (default)   Delete          Immediate           false                  12s

Creating a persistent volume in the default Storage class

Create a file named default-pvc-storage.yaml with this content:

kind: persistantVolumeClaim
apiVersion: v1
  name: default-pvc-storage
    - ReadWriteOnce
  storageClassName: "default"
      storage: 2Gi

The persistent storage name is next to name, storageClassName contains the name of the Storage Class that is used for this volume.

Run this command to create the persistent volume:

# Create a namespace that will be used for my persistent volume.
kubectl create namespace myspace
# Applying the configuration file to the created namespace.
kubectl apply -f default-pvc-storage.yaml -n myspace
# Display persistent volumes of created namespace
kubectl get pv,pvc -n myspace

Go back to the inventory in your vCenter interface, click on the DataCenter icon on the left, then go to the Monitor tab on the right, and click on Container Volumes to see the persistent volumes.

The persistent volume that has been created is displayed, and to the right you can see the name of the datastore on which it is stored.

03 Display PV in vCenter 01

Click the notebook icon to the left of the volume to view the details.

03 Display PV in vCenter 02

The information about this persistent storage is displayed, and corresponds to what was created using Kubernetes commands.

03 Display PV in vCenter 03

Go to the Datastore that is used by default, right-click the Files tab and scroll through the folders in the Datastore to the fcd folder.

You see that the folder contains two files, a vmdk file that contains the persistent volume data and an associated temporary file.

03 Display PV in vCenter 04

Creating a persistent volume on the second Storage Class

Return to the Bootstrap virtual machine and use the command line.

Create a file named second-storage-pvc.yaml:

kind: persistantVolumeClaim
apiVersion: v1
  name: second-storage-pvc
    - ReadWriteOnce
  storageClassName: "secondstorageclass"
      storage: 2Gi

The file uses the same syntax as the first persistent storage, but with a different name and Storage Class.

Run this command to create the persistent volume in the myspace namespace:

# Applying the configuration file to the created namespace.
kubectl apply -f second-storage-pvc.yaml -n myspace
# Display persistent volumes of created namespace
kubectl get pv,pvc -n myspace

The persistent volume is created on the second Datastore.

Return to the vCenter interface. You will see that you do not have any new files in the fcd folder.

04 Display PV2 in vCenter 01

Right-click the second Datastore, go to the fcd folder for that datastore. You will see that you have two new files, as in the first datastore.

04 Display PV2 in vCenter 02

Go back to the Datacenter at the root of the datacenters, click on the Monitor tab, and choose Container volumes to see the two persistent volumes appear with their locations in the datastores.

04 Display PV2 in vCenter 03

Go further

Introduction to Tanzu Kubernetes Grid at OVHcloud

Installing Tanzu Kubernetes Grid

Managing Tanzu Management Cluster Grid

Introducing VMware Tanzu Kubernetes Grid

VMware Tanzu Kubenetes Grid documentation

Manual installation of the CLI tool for the deployment of Tanzu Kubernetes GRID

Join our community of users on

Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.

These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community

In accordance with the 2006/112/CE Directive, modified on 01/01/2015, prices exclude VAT. VAT may vary according to the customer's country of residence.