ctrox / csi-s3

A Container Storage Interface for S3
Apache License 2.0
758 stars 167 forks source link

New PVC doesn't persist after pvc recreated #53

Closed idealtech-i3dlabs closed 3 years ago

idealtech-i3dlabs commented 3 years ago

Setting reclaimPolicy to Retain in my storageclass (from a MinIO server) under csi-s3 doesn't seem to work, even though mounts appears properly in pods with s3fs.

Every time a new pvc is created, a new pvc-xxx-xxxxx-xxxxxx-xxxxxx object is created in MinIO inside bucket mybucket, which means the data becomes not persistent. (I would think it should pick up the existing pvc instead of generating a new one?)

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-minio-permvol
  namespace: dev
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 100Gi
  storageClassName: s3bucket-permstore

and storageclass:

parameters:
  bucket: mybucket
  csi.storage.k8s.io/controller-publish-secret-name: csi-s3-secret
  csi.storage.k8s.io/controller-publish-secret-namespace: kube-system
  csi.storage.k8s.io/node-publish-secret-name: csi-s3-secret
  csi.storage.k8s.io/node-publish-secret-namespace: kube-system
  csi.storage.k8s.io/node-stage-secret-name: csi-s3-secret
  csi.storage.k8s.io/node-stage-secret-namespace: kube-system
  csi.storage.k8s.io/provisioner-secret-name: csi-s3-secret
  csi.storage.k8s.io/provisioner-secret-namespace: kube-system
  mounter: s3fs
provisioner: ch.ctrox.csi.s3-driver
reclaimPolicy: Retain
volumeBindingMode: Immediate

Any idea why ?

idealtech-i3dlabs commented 3 years ago

OK, after more research, looks like this is working as intended. Setting reclaimPolicy to Retain doesn't mean the volume will survive its destruction in the Kubernetes cluster and can be reclaimed later. It just means that is will stay available in the storage medium, severing its links with Kubernetes.