![](/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.