We have been trying to find ways to get volumesnaphot working on a kubernetes deployment on Windows Docker, but it has always failed us as it is Windows underlying kubernetes.
We found that minikube was using https://github.com/kubernetes-csi/csi-driver-host-path so we started to look at how to deploy that into our environment.
It took a little finagling using a wsl2 container as the deployment needed a linux runtime to do the deployment. Anyway here are the steps we took.
deployment
Start a wsl2 container such as ubuntu that has docker integration enabled via Terminal and issue the following commands
cd csi-driver-host-path/
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-6.3/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-6.3/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-6.3/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v6.3.3/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v6.3.3/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml
deploy/kubernetes-latest/deploy.sh
When all is finished issue the following for sanity checks
returns
csi-hostpath-snapclass hostpath.csi.k8s.io Delete 24h
check for similar
snapshot-controller-59db5f898f-dj8ct 1/1 Running 0 24h
snapshot-controller-59db5f898f-z2p59 1/1 Running 0 24h
storage-provisioner 1/1 Running 67 (15d ago) 111d
check for similar
csi-hostpath-socat-0 1/1 Running 0 24h
csi-hostpathplugin-0 8/8 Running 0 24h
check for similar
csi-hostpath-snapclass hostpath.csi.k8s.io Delete 24h
Testing
The following describe shows how to test and validate it is working
kubens default
kubectl apply -f examples/csi-app.yaml
check it is running
returns similar to
my-csi-app 1/1 Running 0 24h
Test File
Add a file to the file system
Check CSI Host
should return similar to
/csi-data-dir/7f3fae05-f52c-11ee-9c3e-1a6977443d45/hello-world
We will expand further on how to use this in a later article.