![](/img/trans.png)
[英]How to change /etc/resolv.conf file in an OpenShift pod
[英]Is there a different way to include .conf file in my pod?
我正在使用我的 pod 中的一个 conf 文件,这是我的应用程序所必需的。 现在我正在将此 conf 文件直接添加到我的 Docker 映像中
COPY ./example.conf /etc/example.conf
这是我的conf文件的内容
[example]
url = url
username = username
password = password
我希望能够通过 helm(或其他方式)动态提供 url,因此 docker image 方法不适合。 我该如何解决这个问题?
您应该使用volume
和volumeMount
来重构您的项目。
笔记:
例如
configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test-conf
data:
example.conf: |
url = url
username = username
password = password
豆荚.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.