How to use a config map to create a single file within container?
You can use subPath
to mount the single file you want.
volumeMounts: - mountPath: /opt/app-root/src/index.html subPath: index name: index
https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath
You can do the following, taken from this GitHub issue
containers:- volumeMounts: - name: config-volumes mountPath: /opt/app-root/src/index.html subPath: indexvolumes:- name: config-volumes configMap: name: index-for-nginx
Note: A container using a ConfigMap as a subPath volume will not receive ConfigMap updates.