[英]Is there a different way to include .conf file in my pod?
I'm making use of a conf file in my pod which is necessary for my application.我正在使用我的 pod 中的一个 conf 文件,这是我的应用程序所必需的。 Right now I'm adding this conf file directly to my Docker image with
现在我正在将此 conf 文件直接添加到我的 Docker 映像中
COPY ./example.conf /etc/example.conf
This is the contents of my conf file这是我的conf文件的内容
[example]
url = url
username = username
password = password
I want to be able to give the url dynamically via helm (or some other way), so the docker image method is not suitable.我希望能够通过 helm(或其他方式)动态提供 url,因此 docker image 方法不适合。 How do I approach this problem ?
我该如何解决这个问题?
You should use volume
and volumeMount
to refactor your project.您应该使用
volume
和volumeMount
来重构您的项目。
Note:笔记:
eg例如
configmap.yaml configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test-conf
data:
example.conf: |
url = url
username = username
password = password
pod.yaml豆荚.yaml
apiVersion: v1
kind: Pod
metadata:
name: test-pod
spec:
containers:
- name: test
image: busybox:1.28
volumeMounts:
- name: conf
mountPath: /etc/
volumes:
- name: conf
configMap:
name: test-conf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.