kubernetes-csi/csi-driver-host-path

failed to provision volume with StorageClass "csi-hostpath-sc": error getting handle for DataSource Type PersistentVolumeClaim by Name pvc-claim-1: claim in dataSource not bound or invalid

abdelghanimeliani opened this issue · 5 comments

im trying to test the clone functionality of the csi driver , i m folowing this documentation :

i created a pv and a pvc and a storage class with the following configurations :

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-volume-1
  labels:
    type: local
spec:
  storageClassName: csi-hostpath-sc
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-claim-1
spec:
  storageClassName: csi-hostpath-sc
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: csi-hostpath-sc
provisioner: hostpath.csi.k8s.io
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true

and i created a new pvc to clone the existing pv content with the folowinf config

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
    name: clone-of-pvc-1
    namespace: default
spec:
  storageClassName: csi-hostpath-sc
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  dataSource:
    kind: PersistentVolumeClaim
    name: pvc-claim-1

the pvc was created but it's always in the peding state :

image

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

erbg commented

Hello abdelghanimeliani,

We had the same problem with our AKS cluster.

The problem was that our DataSource PVC was not on a CSI Persistent volume.
So we created the second PVC on the new CSI Storageclass and used the pv-migrate tool to copy the content.

[How to migrate persistent volumes] (https://bluelight.co/blog/how-to-migrate-persistent-volumes-on-kubernetes)

Hope this helps you.

thanks @erbg , i will test this .

abate commented

I've exactly the same problem. I'm trying to make it work with minikube and a local hostpath.

  Normal   Provisioning          83s (x8 over 3m30s)  hostpath.csi.k8s.io_csi-hostpathplugin-722ct_a0738070-c8da-48af-babc-9ea818aa794f  External provisioner is provisioning volume for claim "default/datadir"
  Warning  ProvisioningFailed    83s (x8 over 3m30s)  hostpath.csi.k8s.io_csi-hostpathplugin-722ct_a0738070-c8da-48af-babc-9ea818aa794f  failed to provision volume with StorageClass "csi-hostpath-sc": error getting handle for DataSource Type PersistentVolumeClaim by Name datadir-template: claim in dataSource not bound or invalid
  Normal   ExternalProvisioning  0s (x17 over 3m43s)  persistentvolume-controller                                                        waiting for a volume to be created, either by external provisioner "hostpath.csi.k8s.io" or manually created by system administrator

but

$ k describe pvc datadir-template 
Name:          datadir-template
Namespace:     default
StorageClass:  csi-hostpath-sc
Status:        Bound
Volume:        datadir-static
Labels:        <none>
Annotations:   pv.kubernetes.io/bind-completed: yes
               pv.kubernetes.io/bound-by-controller: yes
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      10Gi
Access Modes:  RWO
VolumeMode:    Filesystem
Used By:       <none>
Events:        <none>

and

$ k describe pv datadir-static 
Name:            datadir-static
Labels:          name=datadir-static
Annotations:     pv.kubernetes.io/bound-by-controller: yes
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    csi-hostpath-sc
Status:          Bound
Claim:           default/datadir-template
Reclaim Policy:  Retain
Access Modes:    RWO
VolumeMode:      Filesystem
Capacity:        10Gi
Node Affinity:   <none>
Message:         
Source:
    Type:          HostPath (bare host directory volume)
    Path:          /datadir
    HostPathType:  
Events:            <none>

how did you solve this problem ?