Learn how to manage persistent volumes on a Tanzu Kubernetes Grid cluster.
This tutorial is designed to help you as much as possible with common tasks. If you are having difficulty performing these actions, please contact a specialized service provider. OVHcloud can't provide you with technical support in this regard.
Requirements
- Being an administrative contact of your Hosted Private Cloud infrastructure to receive login credentials
- A user account with access to the OVHcloud Control Panel
- A user account with access to vSphere
- You need to have deployed the Workload TKGcluster using the Tanzu Management Cluster Grid Administration guide.
Introduction
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.
You can create additional Storage Classes for each WorkLoad cluster.
Instructions
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:
Run this command to use the WorkLoad cluster:
Displaying Existing Storage Classes
For information about the Storage Classes in a WorkLoad cluster, run these commands:
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.
Go to the console of the Bootstrap virtual machine, edit a new file named secondstorageclass.yaml
with this content:
Edit the file by replacing ds:///vmfs/volumes/xxxxxxxxxxxxxxxxx/
with the URL you just copied.
Next, run this command:
We are now seeing two Storage Classes:
Creating a persistent volume in the default Storage class
Create a file named default-pvc-storage.yaml
with this content:
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:
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.
Click the notebook icon to the left of the volume to view the details.
The information about this persistent storage is displayed, and corresponds to what was created using Kubernetes commands.
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.
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
:
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:
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.
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.
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.
Go further
For more information and tutorials, please see our other VMware on OVHcloud or Hosted Private Cloud guides. You can also explore the guides for other OVHcloud products and services.