Persistent volume restored from backup - can't create pvc

Hi all,

I am new to Rancher and Longhorn and so far I am absolutely LOVING this stuff! I am having a weird issue when restoring volumes from backup. Actually the restore itself is easy and it works, but I see errors when trying to reuse them in Rancher.

So if I restore a volume from a backup, I then go (in Rancher) to luster/Storage/Persistent Volumes and create a volume selecting Longhorn as the plugin and the storage class, and correctly configuring the capacity/size to the same value as the actual size of the volume restored. When I create this volume I don’t see any errors etc, but when I create a persistent volume claim (project/Workloads/Volumes) and select the persistent volume I just created, the pvc is stuck in ‘pending’ state and I get the following error in the events:

Cannot bind to requested volume "wp-app": storageClassName does not match

So it doesn’t work and I can’t use that pvc when deploying Wordpress in this example.

However, I watched a Rancher meetup video from September (on Youtube) about Longhorn, and following that I tried creating the persistent volume the kubectl/yaml way with this yaml:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: wp-app
spec:
  capacity:
    storage: 1Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Delete
  csi:
    driver: io.rancher.longhorn
    fsType: ext4
    volumeAttributes:
      numberOfReplicas: '3'
      staleReplicaTimeout: '20'
    volumeHandle: wp-app

This way all works and when I create the pvc the state changes to ‘bound’, after which I can launch the app and select the pvc etc.

So the question is, is it a bug in Rancher when linking persistent volumes to Longhorn volumes, or in Longhorn? Am I doing it wrongly? Is it possible to do this through the UI instead of the yaml way?

Thanks a lot in advance!

Hi @Vito_Botta

Yeah, it’s a Rancher bug, and we haven’t got time to fix it in 2.2 release.

Also, in Longhorn v0.5.0 (next release), we will add support to create PV/PVC from Longhorn directly so it would be easier for user to use restored volumes in Longhorn.

Thanks for the confirmation, and for all the work behind these amazing projects! Really loving this stuff.
I was wondering whether I could use Longhorn in production already? At the moment I am experimenting but I would love to use it as the storage backend for a cluster I will use for a new project I have just started. Would this be OK or not yet? Thanks!

Thanks @Vito_Botta , but Longhorn is not production ready yet. Storage system is very critical to user’s data, so we have been very conservative about people using it in the production.

We’re planning to release v0.5.0 as Beta in a couple of month, and release v1.0 GA this year.

In any case, keep a good backup of your volume is critical to the safety of your volume. We will add more features to help and emphasis that in the coming releases.

I see :slight_smile: I will continue to play with it for now and looking forward to the GA!