如何在kubernetes中将多个configmap放在同一装载路径中?
我有两个python文件,如何在kubernetes中将多个configmap放在同一装载路径中?,kubernetes,configmap,Kubernetes,Configmap,我有两个python文件,testing_1.py和testing_2.py。 然后,我用testing-config1创建了configmap,分别存储testing\u 1.py和testing-config2以存储testing\u 2.py 在Kubernetes yaml ... containers: - name: spark-master image: bde2020/spark-master:2.4.4-hadoop2.7
testing_1.py
和testing_2.py
。
然后,我用testing-config1
创建了configmap,分别存储testing\u 1.py
和testing-config2
以存储testing\u 2.py
在Kubernetes yaml
...
containers:
- name: spark-master
image: bde2020/spark-master:2.4.4-hadoop2.7
volumeMounts:
- name: testing
mountPath: /jobs
- name: testing2
mountPath: /jobs
volumes:
- name: testing
configMap:
name: testing-config1
- name: testing2
configMap:
name: testing-config2
...
在最终结果中,路径仅包含testing_1.py。您可以将这两个文件放在同一个ConfigMap中 或者,使用卷: 投影体积将多个现有体积源映射到同一个体积源 目录 目前,可以预测以下类型的体积源:
- 秘密
- 向下API
- 配置映射
- serviceAccountToken
您可以在指定路径的同时提供
子路径
。更改如下:
containers:
- name: spark-master
image: bde2020/spark-master:2.4.4-hadoop2.7
volumeMounts:
- name: testing
mountPath: /jobs/testing_1.py
subPath: testing_1.py
- name: testing2
mountPath: /jobs/testing_2.py
subPath: testing_2.py
volumes:
- name: testing
configMap:
name: testing-config1
- name: testing2
configMap:
name: testing-config2
您希望实现的具体结构是什么?