I have this very simple container image:
FROM nvidia/cuda:8.0-runtime-centos7
VOLUME ["/myvolume"]
# hack to keep the container alive and listening...
CMD exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"
I want to deploy it to minikube 0.25.2 (on windows 10) via Kubernetes. I want /myvolume
to be mounted to the hostPath c:\TestDir\
(with syntax /c/TestDir/
). TestDir
is shared with anyone with full control.
I use "Persistent Volume Claims" to achieve the purpose. This is the .yaml the I use:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
run: hello-mount
name: hello-mount
namespace: default
spec:
replicas: 1
selector:
matchLabels:
run: hello-mount
template:
metadata:
labels:
run: hello-mount
spec:
containers:
- image: docker.io/myid/host_mount_img
name: hello-mount
volumeMounts:
- name: myvolumelbl
mountPath: /myvolume
volumes:
- name: myvolumelbl
persistentVolumeClaim:
claimName: data-pvc
---
kind: PersistentVolume
apiVersion: v1
metadata:
name: data-pv
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 2Mi
hostPath:
path: /c/TestDir/
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: data-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Mi
volumeName: data-pv
According to kubernetes dashboard, /myvolume is correctly mounted to /c/TestDir but when I get into the pod the directory /myvolume is empty - i.e. I cannot see the content of /c/TestDir
Any help is welcome......
It looks like the issue with minikube on Hyper-V. It didn't fix it. So my advice for you: try to use VirtualBox vm-driver.
Create a shared folder in VirtualBox and use it as a Persistent Volume.