Reputation: 81
I'm making use of a conf file in my pod which is necessary for my application. Right now I'm adding this conf file directly to my Docker image with
COPY ./example.conf /etc/example.conf
This is the contents of my conf file
[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. How do I approach this problem ?
Upvotes: 0
Views: 210
Reputation: 2527
You should use volume
and volumeMount
to refactor your project.
Note:
e.g.
configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test-conf
data:
example.conf: |
url = url
username = username
password = password
pod.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
Upvotes: 2