Our .NET Core applications have been using appsettings.json file to store of its app settings. When deploying to the different Azure environments, we are using Octopus’s feature to transform json files on each deployment.
How do you do the same with Kubernetes (k8s) deployment?
When the k8s deployment step starts, the container image must already exist, and there’s no way of editing the appsettings.json within it. So we have been re-building the image from a nuget package during each deployment (we are using Azure Container Registry to build our images), although this approach works, it is not ideal for so many reason.
Ideally, we would like to do the following:
- Unpack a nuget package (from octopus package source)
- Pick the ‘appsettings.json’ in the package
- Perform variable substitution on the file
- Create a ‘Config Map’ resource in K8s based on the newly transformed appsettings.json
- Use the above Config Map resource during K8s deployment
Any ideas how to do this?