Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect existing block storage volumes? #85

Closed
feluxe opened this issue Sep 27, 2018 · 6 comments · Fixed by #87
Closed

Connect existing block storage volumes? #85

feluxe opened this issue Sep 27, 2018 · 6 comments · Fixed by #87

Comments

@feluxe
Copy link
Contributor

feluxe commented Sep 27, 2018

Hi there,

is it possible to use csi-digitalocean to connect a kubernetes pod to an existing block storage volume?

I looked at the docs, examples and the issues, but I couldn't find anything related to this.

@Richard87
Copy link

Following (I'm also interested in this, specifically in a recovery, how do I reattach volumes to a new cluster if necessary?)

@feluxe
Copy link
Contributor Author

feluxe commented Sep 28, 2018

I was using the stackpoint digitalocean provisioner before and there you could select an existing volume via VolumeName and VolumeID in a PV. You could add a claimRef to the PV to bind it to a PVC. It worked quite well.

I'd much prefer something like this tho:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: csi-pvc
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: do-block-storage
  volumeId: 2478ae4c-c31f-44s8-5242-0a58ac14d085

The same discussion for other digitalocean provisioners:

@fatih
Copy link
Contributor

fatih commented Oct 1, 2018

This is not currently possible with the CSI plugin because there is no way to pass down metadata (i.e annotations). If that would be possible, we could pass down the existing volume name via the PVC, such as:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: csi-pvc
  annotations:
    volumeId: "2478ae4c-c31f-44s8-5242-0a58ac14d085"
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: do-block-storage

Then our CSI plugin could read the annotations and decide not to create a new volume and instead re-use the existing volume.

There is an open issue that tracks this feature in the CSI spec and K8S, see: kubernetes-csi/external-provisioner#86 Until there is an official way of doing this, it's not possible unfortunately.

@firatkucuk
Copy link

Any progress about this issue? 'cause don't want to hassle for transferring all my volume content.

@snormore
Copy link

I was successful in using existing volumes by following this example https://github.com/digitalocean/csi-digitalocean/blob/master/examples/kubernetes/pod-single-existing-volume/README.md

@firatkucuk
Copy link

If it's mature enough, it might be good to see it in the official documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants