[英]Hostpath volume not mounting on kubernetes running on Docker-desktop for windows
I am running kubernetes on Docker-desktop for windows.我在 Docker 桌面上为 windows 运行 kubernetes。 I am connecting to the cluster from my WSL.我正在从我的 WSL 连接到集群。 all my pods are running correctly.我所有的 pod 都运行正常。 I am trying to mount a volume on my jupyterlab (pod) using hostpath.我正在尝试使用主机路径在我的 jupyterlab(pod)上安装一个卷。 below is my config下面是我的配置
apiVersion: apps/v1
kind: Deployment
metadata:
name: jupyter
labels:
app: jupyter
spec:
replicas: 1
selector:
matchLabels:
app: jupyter
template:
metadata:
labels:
app: jupyter
spec:
containers:
- name: jupyter
image: jupyter:1.1
ports:
- containerPort: 8888
securityContext:
runAsNonRoot: true
runAsUser: 1000
volumeMounts:
- name: mydir
mountPath: /notebooks
volumes:
- name: mydir
hostPath:
# directory location on host
path: /home/<myuser>/data
# this field is optional
type: DirectoryOrCreate
The pod starts without any issues.吊舱启动没有任何问题。 but i dont see the notbooks which i have kept in my hostpath onto my jupyter labs and vice versa( if i save a notebook in jupyter lab it does not get saved to my hostpath).但我没有看到我保存在我的主机路径中的笔记本到我的 jupyter 实验室,反之亦然(如果我在 jupyter 实验室保存笔记本,它不会保存到我的主机路径)。
i followed the tutorial on https://kubernetes.io/docs/concepts/storage/volumes/#hostpath我按照 https 上的教程进行 操作://kubernetes.io/docs/concepts/storage/volumes/#hostpath
i want to point out that i am using the @FROM jupyter/datascience-notebook:python-3.7.6" as my docker image.我想指出我正在使用 @FROM jupyter/datascience-notebook:python-3.7.6" 作为我的 docker 图像。
i tried mounting /home/jovyan/ but it was giving me access related errors while starting the pod.我尝试安装 /home/jovyan/ 但它在启动 pod 时给了我访问相关的错误。 so i reverted back to "/notebooks"所以我恢复到“/notebooks”
It looks like an issue with how the path is being written on Windows, I see the issue reported in the references below.看起来如何在 Windows 上写入路径存在问题,我在下面的参考资料中看到了该问题。
Solution:解决方案:
/host_mnt/c/path/to/my/folder
References: https://github.com/kubernetes/kubernetes/issues/59876#issuecomment-628955935 https://github.com/docker/for-win/issues/1703#issuecomment-366701358 .参考文献: https://github.com/kubernetes/kubernetes/issues/59876#issuecomment-628955935 https://github.com/docker/for-win/issues/1703#issuecomment-
If you are using WSL based engine on windows, the path should be /run/desktop/mnt/host/c/<folder>
如果您在 windows 上使用基于 WSL 的引擎,则路径应为/run/desktop/mnt/host/c/<folder>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.