我在K8
主服务器上有目录。
我有20个吊舱(带有部署副本)。
我希望所有Pod从主目录/path/in/master/infiles
中读取,并将其输出写入同一目录/path/in/master/outfiles
中,在这种情况下我需要使用哪种卷类型?我希望我的文件在Pod死后不被删除。
我试图查看以下内容:https://kubernetes.io/docs/concepts/storage/volumes/,但仍然不知道什么是我的案例的最佳选择。
有什么建议吗?
您可以使用hostPath音量。
hostPath
卷将主机节点文件系统中的文件或目录装载到Pod中。
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/path/in/master/infiles"
https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/