Kubernetes卷类型

问题描述 投票:0回答:1

我在K8主服务器上有目录。

我有20个吊舱(带有部署副本)。

我希望所有Pod从主目录/path/in/master/infiles中读取,并将其输出写入同一目录/path/in/master/outfiles中,在这种情况下我需要使用哪种卷类型?我希望我的文件在Pod死后不被删除。

我试图查看以下内容:https://kubernetes.io/docs/concepts/storage/volumes/,但仍然不知道什么是我的案例的最佳选择。

有什么建议吗?

kubernetes
1个回答
0
投票

您可以使用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/

© www.soinside.com 2019 - 2024. All rights reserved.