I have a yaml
file which needs to be loaded into my pods
, this yaml
file will have both sensitive and non-sensitive data, this yaml
file need to be present in a path which i have included as env
in containers.
env:
- name: CONFIG_PATH
value: /myapp/config/config.yaml
If my understanding is right, the configmap
was the right choice, but i am forced to give the sensitive data like password as plain text in the values.yaml
in helm
chart.
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
labels:
app: {{ .Release.Name }}-config
data:
config.yaml: |
configuration:
settings:
Password: "{{.Values.config.password}}"
Username: myuser
Values.yaml
config:
password: "mypassword"
Mounted the above config map as follows
volumeMounts:
- name: {{ .Release.Name }}-config
mountPath: /myapp/config/
So i wanted to try secret
, If i try secret, it is loading as Environment Variables
inside pod, but it is not going into this config.yaml
file.
If i convert the above yaml
file into secret
instead of configmap
, should i convert the entire config.yaml
into base64
secret? my yaml
file has more entries and it will look cumbersome and i dont think it as a solution.
If i take secret
as a stringdata
then the base64
will be taken as it is.
How do i make sure that config.yaml
loads into pods with passwords
not exposed in the values.yaml
Is there a way to combine configmap
and secret
I read about projected
volumes, but i dont see a use case for merging configmap
and secrets
into single config.yaml
Any help would be appreciated.