<p>Is it possible to directly modify the file mounted by <code>configMap</code>? We have an application that reads a configuration file that was <code>configMap</code> type and the application should able to edit the file and the changes should be persisted if the <code>configMap</code> is shared with other pods and when the pod restarts. </p>

<p>If <code>configMap</code> is not meant for this, then what should we relay on <code>consul</code> to save the configuration?</p>

<p>Yes a configmap is <a href="https://github.com/kubernetes/kubernetes/issues/62099" rel="noreferrer">not intended to be writeable</a>. If you're interacting with files from a configmap then you could instead put the files in a writeable volume and <a href="https://stackoverflow.com/questions/45681206/what-would-be-an-ideal-way-to-share-writable-volume-across-containers-for-a-web">mount the volume</a>. Or you could, as you suggest, use centralised configuration like consul. Given, that the app is dynamically writing to this data you could consider it state rather than configuration. Then it could be stored in a database. Another option could be a distributed cache <a href="https://redislabs.com/ebook/part-2-core-concepts/chapter-5-using-redis-for-application-support/5-4-service-discovery-and-configuration/5-4-1-using-redis-to-store-configuration-information/" rel="noreferrer">such as redis</a> or hazelcast.</p>
