Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
211 views
in Technique[技术] by (71.8m points)

Changing configuration of net core application running on kubernetes

I have a ASP.NET Core Worker Service which gets some information like thread count, batch size etc. from appsettings.json. 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.

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.

I can come up with these solution:

  1. Mapping appsetttings.json to a volume, to be able to change it, so that when container is restarted the appsettings is not reverted.
    • Do I need to move the appsettings.json file to another folder then root? Is there something about not mapping the running application to a volume?
  2. Update the containers environment variables to override settings.
    • Will these settings be reverted back when the container is restarted?)

Any other ideas?

question from:https://stackoverflow.com/questions/65916977/changing-configuration-of-net-core-application-running-on-kubernetes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Depending on the content of your application json you may store it inside ConfigMap or Secret and then mount it into the pod.

Both ConfigMap and Secret are stored in Kubernetes API and are always mounted into the pod read-only. Please read provided links to understand how to create and mount them inside your pods.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...