Published: September 26, 2019
Updated: January 07, 2023
Tags: OpenStack, Rancher, Kubernetes
4 min read

OpenStack Cinder As A Persistent Storage For Rancher

A follow-up to blog post Adding OpenStack Cloud Provider To Rancher Cluster

Tested on Rancher 2.2.4

Storage In Containerized World

Docker containers are transient. Once they fulfill their purpose and are deleted, they do not retain any data.
With the adoption and the growing use cases of Docker, an option to store container data was required.

There are two popular mechanisms for persistent storage for containers:

  1. Docker Volumes [1] - Areas on the filesystem which Docker manages. Volumes are managed directly by Docker binaries, can be shared between containers, works across the platform, is easy to backup/migrate and contain drivers that allow storing data on various storage backends (one of them is OpenStack Cinder).
  2. Bind Mounts [2] - A file/directory which is bound to a container. They rely on the host machine's filesystem and can not be shared between containers.

Persistent Storage In Kubernetes

Kubernetes leverages docker volumes to provide persistent storage capabilities.

Persistent Volume [3] is a chunk of storage that was provisioned by a user or Storage Class [4] which is exposed to the cluster.

A persistent Volume Claim is a request for storage that consumes Persistent Volume. Claims can request specific sizes and access modes.

OpenStack Cinder As A Persistent Kubernetes Storage Backend

Kubernetes natively supports OpenStack Cinder as one of its storage backends [5].

OpenStack Cinder based volumes only support a single access mode, ReadWriteOnce, a single container may only read and write to a volume, and the data can not be shared between containers.

Configuring OpenStack Cinder As A Storage Backend in Rancher

Requires to have OpenStack configured as a Kubernetes Cloud Provider

Navigate to the Rancher dashboard and select the cluster containing an OpenStack cloud provider:
Rancher Cluster Dashboard

Add Storage Class

Select Storage > Storage Classes from the top menu:
Rancher Cluster Storage Menu Entry
Add a storage class to the cluster by clicking on Add Class:
Rancher Cluster Storage Class Dashboard
Add Storage Class view:
Rancher Add Storage Class View
Select OpenStack Cinder from the dropdown menu:
Rancher Add Storage Class View - Provisioner Selection
OpenStack Cinder Storage Class Options:
Rancher Add OpenStack Cinder Storage Class View

  • Name - Name given to Storage Class
  • Description - Description of Storage Class Entity
  • Provisioner - Kubernetes Storage Provisioner to use
  • Parameters - Extra params for Storage Class:
    • Volume Type - Cinder backend to use for Storage Class (OpenStack Cinder has the option to expose multiple backends to the operator [6])
    • Availability Zone - Nova availability that contains Cinder backend
  • Customize - Advanced options:
    • Reclaim Policy - Set if volumes should be deleted after containers are deleted
    • Mount Options - Additional mount options passed to Docker volume

Once Storage Class is created, it will appear as:
Rancher Populated Storage Class View

Testing OpenStack Cinder Storage

There are several ways of creating persistent volumes, which are not all covered in this section

To verify that your Storage Class allows creating persistent volumes, we'll deploy a workload (refer to workload deployment [7]

Creating Persistent Volume Claim

During workload creation, we can create a pvc based on a previously configured storage class:
Create persistent volume claim
Add Volume Claim view:
Add Volume Claim view

  • Name - Name given to volume claim
  • Description - Description of volume claim
  • Source - Source which fulfills the volume claim
    • Storage Class - Storage class to use for volume claim
    • Capacity - Storage capacity to provision
  • Customize - Set access mode of volume.
    OpenStack Cinder supports only 'Single Node Read-Write'.

Configure volume mount on created persistent volume:
Volume mount in Volumes view

  • Volume Name - Name given to volume
  • Volume Type - Kubernetes volume types [8], in our case it will be persistentVolumeClaim
  • Mount Point - Mount point to be used in container
  • Sub Path in Volume - Sub path inside root directory of volume [9]
  • Read Only - Set Read Only to mount

If the storage configuration is valid, a workload should be spawned, and it should appear in the Persistent Volumes in Cluster dashboard:
Persistent Volumes view
The created volume will appear in the OpenStack dashboard as well:
OpenStack Volumes view


Docker volumes allow persistent storage capabilities in Kubernetes.
OpenStack Cinder is a block based storage that is used as part of OpenStack clouds.
Kubernetes Storage Classes allow operators to leverage various storage solutions.

  1. Docker documentation - Using Volumes ↩︎

  2. Docker documentation - Using bind mounts ↩︎

  3. Kubernetes documentation - Persistent Volumes ↩︎

  4. Kubernetes documentation - Storage Classes ↩︎

  5. Kubernetes documentation - Storage Classes - OpenStack Cinder ↩︎

  6. OpenStack documentation - Cinder - Configure multiple-storage back ends ↩︎

  7. - Deploying Rancher On OpenStack - Deploy Workload ↩︎

  8. Kubernetes documentation - Volumes - Types of Volumes ↩︎

  9. Kubernetes documentation - Volumes - Using subPath ↩︎