我正在尝试使用ksonnet原型将本地目录装入部署在kubeflow中的组件中。
发布于 2018-05-30 07:53:13
没有办法将本地目录挂载到Kubernetes荚中(毕竟kubeflow和ksonnet只是创建荚和其他Kubernetes资源)。
如果您希望您的文件在Kubernetes中可用,我可以从以下两个选项来考虑:
如果您提供了更多关于您试图部署的组件以及您使用的云提供商的信息,我可以为您提供更多的帮助
发布于 2018-05-30 09:51:19
如果本地目录是指节点上的本地目录,那么可以使用HostPath或Local 卷特性将目录挂载到pod中的节点文件系统上。
hostPath卷将文件或目录从主机节点的文件系统加载到Pod中。这不是大多数Pods需要的东西,但它为某些应用程序提供了一个强大的逃生舱口。
本地卷表示安装的本地存储设备,如磁盘、分区或目录。
本地卷只能用作静态创建的PersistentVolume。目前还不支持动态配置。
与hostPath卷相比,本地卷可以以持久和可移植的方式使用,而无需手动将Pods调度到节点,因为系统通过查看PersistentVolume上的节点关联来了解卷的节点约束。
例如:
# HostPaht Volume example
apiVersion: v1
kind: Pod
metadata:
name: test-pd
spec:
containers:
- image: k8s.gcr.io/test-webserver
name: test-container
volumeMounts:
- mountPath: /test-pd
name: test-volume
volumes:
- name: test-volume
hostPath:
# directory location on host
path: /data
# this field is optional
type: Directory
# local volume example (beta in v1.10)
apiVersion: v1
kind: PersistentVolume
metadata:
name: example-pv
spec:
capacity:
storage: 100Gi
# volumeMode field requires BlockVolume Alpha feature gate to be enabled.
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
storageClassName: local-storage
local:
path: /mnt/disks/ssd1
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- example-nodeGlusterFS也可作为音量或持久体积 (访问模式:读写方式、ReadOnlyMany、ReadWriteMany)提供。
Glusterfs 卷允许将Glusterfs(一个开源网络文件系统)卷挂载到Pod中。与emptyDir不同的是,当Pod被移除时会被擦除,而glusterfs卷的内容会被保留,而卷只是被卸载。这意味着一个胶辊卷可以预先填充数据,数据可以在Pods之间“传递”。GlusterFS可以由多个写入器同时挂载。
有关更多细节,请参见GlusterFS实例。
https://stackoverflow.com/questions/50597772
复制相似问题