我正在考虑使用秘密来挂载单个文件,但似乎您只能挂载会覆盖所有其他内容的目录。如何在不安装目录的情况下共享单个配置文件?
例如,您有一个包含 2 个配置文件的 configmap:
kubectl create configmap config --from-file <file1> --from-file <file2>
您可以使用这样的 subPath 将单个文件安装到现有目录中:
---
volumeMounts:
- name: "config"
mountPath: "/<existing folder>/<file1>"
subPath: "<file1>"
- name: "config"
mountPath: "/<existing folder>/<file2>"
subPath: "<file2>"
restartPolicy: Always
volumes:
- name: "config"
configMap:
name: "config"
---
完整示例here
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)