If you want to check if nfs storage can be used and mounted, then you can use this note to check the status.
You have nfs storage:
$ kubectl -n hub get pods | grep nfs
nfs-project-infuseai-0 1/1 Running 0 8d
Install nfs-common
$ sudo apt-get install nfs-common -y
Get the mount IP address
$ kubectl -n hub get svc | grep nfs
nfs-project-infuseai ClusterIP <nfs-ip-address> <none> 2049/TCP,20048/TCP,111/TCP 31d
Use mount
to check the nfs-storage by first mounting it locally.
$ mkdir test-mount/
$ sudo mount -t nfs <nfs-ip-address>:/ test-mount/
$ cd test-mount && ls
Check the nfs storage by first mounting it locally.
$ sudo umount test-mount/
Use mountpvc kubectl extention tool to mount the nfs storage pods folder to other kubernetes pods folder.
$ kubectl -n hub get pvc | grep nfs-project-infuseai
data-nfs-project-infuseai-0 Bound <pv-name> 20Gi RWO rook-block 31d
project-infuseai Bound <pv-name> 20Gi RWX 31d
$ kubectl mountpvc --pvc project-infuseai -n hub test-mount-pvc --image ubuntu:18.04 --command -- sleep 100000 | kubectl apply -f -
Check the folder is in the test-mount-pvc
pod.
In command line:
$ kubectl -n hub get pods | grep test-mount-pvc
test-mount-pvc-<id> 1/1 Running 0 5s
$ kubectl -n hub exec -it test-mount-pvc-<id> -- bash
In Kubernetes pods:
root@test-mount-pvc-<id>:/# cd pvcs/project-infuseai/
root@test-mount-pvc-<id>:/pvcs/project-infuseai/# ls
Delete the deployment to unmount the nfs storage.
$ kubectl -n hub get deploy | grep test-mount-pvc
test-mount-pvc 1/1 1 1 3m45s
$ kubectl -n hub delete deploy test-mount-pvc
deployment.apps "test-mount-pvc" deleted
N/A