You can create a ConfigMap object and then mount the values as files where you need them:
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
nginx.conf: |
your config
comes here
like this
other.conf: |
second file
contents
And in you pod spec:
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
- name: other.conf
mountPath: /etc/nginx/other.conf
subPath: other.conf
volumes:
- name: nginx-config
configMap:
name: nginx-config
(Take note of the duplication of the filename in mountPath and using the exact same subPath; same as bind mounting files.)
For more information about ConfigMap see:
https://kubernetes.io/docs/user-guide/configmap/
Note: A container using a ConfigMap as a subPath volume will not receive ConfigMap updates.