Persistent Volumes on OVHcloud Managed Kubernetes

Find out how to setup and manage Persistent Volumes on OVHcloud Managed Kubernetes

Last updated 19thOctober 2021.

Before you begin

This tutorial presupposes that you already have a working OVHcloud Managed Kubernetes cluster, and some basic knowledge of how to operate it.
If you want to know more on those topics, please look at the OVHcloud Managed Kubernetes Service Quickstart.

When a Persistent Volumes resource is created inside a Managed Kubernetes cluster, an associated Public Cloud Block Storage volume is automatically created with it. This volume is hourly charged and will appear in your Public Cloud project. For more information, please refer to the following documentation: Volume Block Storage price

Persistent Volumes

Before going further, let's review how Kubernetes deals with data storage.
There are currently two kinds of storage available with Kubernetes: Volumes and Persistent Volumes.

Kubernetes Volumes exist only while the container pod exists, and are deleted when it is deleted.
As a result, Kubernetes Volumes are only useful for storing temporary data.

Kubernetes Persistent Volumes allow us to work with non-volatile data in Kubernetes. Persistent Volumes are not tied to the pod lifecycle, or to a single pod. Pods can claim Persistent Volumes, thus making the data available to them.

You must be wondering how Persistent Volumes are compatible with the rule that containers should be stateless – one of the most important principles of best practice for containers. It's important to note that as the Kubernetes ecosystem has matured, and persistent storage solutions have emerged, this rule is no longer universally applicable.

What are the use cases for Persistent Volumes in Kubernetes?
Well, the most common application is databases. Database data, by definition, is meant to be persistent, and not linked to a specific pod, so Persistent Volumes are needed to deploy them in Kubernetes.

When deploying a database in Kubernetes, we follow these steps:

  • Create and configure a pod for the database engine
  • Attach a Persistent Volume to the pod using a Persistent Volume Claim
  • Mount the claimed volume in the pod

In order to use a Persistent Volume on a Kubernetes cluster, you must create a Persistent Volume Claim. Persistent Volume Claims are requests to provision a Persistent Volume of a specific type and configuration. The different kinds of persistent storage are defined by cluster admins, using Storage Classes.

When you need a Persistent Volume, you create a Persistent Volume Claim, and choose a Storage Class from those made available by the cluster administrators. Depending on the Storage Class, an actual infrastructure volume storage device is provisioned into your account and a Persistent Volume is created on this physical device. The Persistent Volume is a sort of virtual storage instance over the infrastructure virtual storage.


Persistent Volumes on OVHcloud Managed Kubernetes

We currently support four Storage Classes on OVHcloud Managed Kubernetes: cinder-classic, cinder-high-speed, csi-cinder-classic and csi-cinder-high-speed.
All of them are based on Cinder, the OpenStack Block Storage service.

The difference between them is the associated physical storage device. The cinder-high-speed and csi-cinder-high-speed use SSD, while cinder-classic and csi-cinder-classic use traditional spinning disks. Both are distributed transparently, on three physical local replicas.

When you create a Persistent Volume Claim on your Kubernetes cluster, we provision the Cinder storage into your account. This storage is charged according to the OVH Flexible Cloud Block Storage Policy.

Since Kubernetes 1.11, support for expanding PersistentVolumeClaims (PVCs) is enabled by default, and it works on Cinder volumes. In order to learn how to resize them, please refer to the Resizing Persistent Volumes tutorial. Kubernetes PVCs resizing only allows to expand volumes, nor to decrease them.

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