I’m trying to use the CSI cloning interface with minikube and a local directory.
this is where I’m stuck :
apiVersion: v1
kind: PersistentVolume
metadata:
name: datadir-ro
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 5Gi
hostPath:
path: /path/to/data
storageClassName: csi-hostpath-sc
to create the PV
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: datadir
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
dataSource:
kind: PersistentVolumeClaim
name: datadir-ro
storageClassName: csi-hostpath-sc
to create the PVC
I initialize the csi cloning using these addons :
minikube addons enable volumesnapshots
minikube addons enable csi-hostpath-driver
to check I use a small pod :
apiVersion: v1
kind: Pod
metadata:
name: datadir-inspector
spec:
containers:
- image: busybox
name: datadir-inspector
command: ["tail"]
args: ["-f", "/dev/null"]
volumeMounts:
- mountPath: /pvc
name: pvc-mount
volumes:
- name: pvc-mount
persistentVolumeClaim:
claimName: datadir
and I look inside the volume
kubectl exec -it datadir-inspector -- sh
ls /pvc
but it’s empty
the pv and pvc looks ok :
$ kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
datadir-ro 5Gi RWO Retain Bound default/datadir csi-hostpath-sc 107m
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
datadir Bound datadir-ro 5Gi RWO csi-hostpath-sc 6m5s
I’m a bit lost. Is there something clearly wrong in what I’m doing ?
$ minikube version
minikube version: v1.31.0
commit: 47aea544e09f11f475f33e8d126f9eb15e34a4c0
thanks !