<p>I have a ASP.NET Core Worker Service which gets some information like thread count, batch size etc. from <code>appsettings.json</code>. These settings will only take affect on startup and cannot be change when the service is running.
The application will be running in a kubernetes cluster.</p>
<p>What is the best practice for changing these settings while deployed in production?
What I need to have done is, changing the settings and restart the service.</p>
<p>I can come up with these solution:</p>
<ol>
<li>Mapping <code>appsetttings.json</code> to a volume, to be able to change it, so that when container is restarted the appsettings is not reverted.
<ul>
<li>Do I need to move the <code>appsettings.json</code> file to another folder then root? Is there something about not mapping the running application to a volume?</li>
</ul>
</li>
<li>Update the containers environment variables to override settings.
<ul>
<li>Will these settings be reverted back when the container is restarted?)</li>
</ul>
</li>
</ol>
<p>Any other ideas?</p>

Michael
<p>In Kubernetes, the suggested way of having these type of configuration settings of non-confidential data is to use the configmap api</p>
<p><a href="https://kubernetes.io/docs/concepts/configuration/configmap/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/configmap/</a></p>
<p>This gives You 1 MB, which should be fine for a typical appsettings file</p>
<p>we're adviced to use yaml format instead of json here and an example from link could be:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: my-app-settings
data:      
  MyKey: &quot;my-value&quot;
  MySecondKey: &quot;my other value&quot;

  # file-like keys, completely optional naming 
  # the app.properties and the operation.properties are just examples
  app.properties: |
    obj.property=value1, value2
    obj2.property-with-dash=value 3    
  operation.properties: |
    obj3.property=value3, value1
    obj4=value4, value 5       
</code></pre>
