**已关闭。**此问题为not about programming or software development。当前不接受答案。
此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题有关,您可以留下评论,说明在何处可以回答此问题。
6小时前关门了。
Improve this question
KubernetesPodOperator接受一个volume_mounts参数和/或一个volumes参数。这两者有什么区别?
此处的文档包含以下代码行:
volume_mount = k8s.V1VolumeMount(
name="test-volume", mount_path="/root/mount_file", sub_path=None, read_only=True
)
路径/root/mount_file是来自运行Airflow工作进程的主机,还是来自运行Pod的主机?(假设Airflow和k8运行在不同的主机上)。
sub_path是什么?如果sub_path被赋予了一个值,例如/foobar,它在挂载方面意味着什么?
1条答案
按热度按时间qoefvg9y1#
volumes和volumeMount之间最基本的区别在于,使用
spec.volumes
时,您是在为整个pod创建卷,而使用spec.container.volumeMount
时,您是在将创建的卷装载到特定容器。卷和volumeMount执行相同的功能,您可以在不创建卷的情况下装载卷(spec.volumes),也可以使用现有卷或创建卷来装载(spec.container.volumeMount)。
Kubernetes清单文件中的样本卷声明:
kubernetes清单文件中的volumeMount声明示例:
注:此内容摘自Seyi Ewegbemi撰写的博客Keeping the State of Apps 1: Introduction to Volume and volumeMounts。