我在Docker-Docker for windows上运行kubernetes。我正在从我的WSL连接到集群。我正在尝试使用hostpath在jupyterlab (pod)上挂载一个卷。
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: DirectoryOrCreatepod启动时没有任何问题。但是我没有看到我在jupyter实验室的主机路径中保存的笔记本,反之亦然(如果我在jupyter实验室中保存一个笔记本,它不会被保存到我的主机路径中)。
我想指出的是,我使用@FROM jupyter/datascience-notebook:python-3.7.6“作为我的docker图像。
我尝试挂载/home/jovyan/,但启动pod时出现访问相关的错误。
发布于 2021-03-04 15:35:46
这看起来像是在Windows上写入路径的问题,我在下面的参考文献中看到了这个问题。
解决方案:
/host_mnt/c/path/to/my/folder参考文献:https://github.com/kubernetes/kubernetes/issues/59876#issuecomment-628955935 https://github.com/docker/for-win/issues/1703#issuecomment-366701358。
https://stackoverflow.com/questions/66467131
复制相似问题