I'm running an ASP.NET Core application.
Everything works correctly when using Docker Compose — all values from appsettings.json load normally, and my services connect to Postgres and RabbitMQ.
But when I deploy the same application to Minikube (Kubernetes), the app stops reading anything from appsettings.json.
In logs I see:
DEBUG: ConnectionStrings:Default = ''
DEBUG: RabbitMQ = ''
etc
And the application throws an error:
fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
An error occurred using the connection to database 'simpchat' on server 'tcp://postgres-service:5432'.
System.Net.Sockets.SocketException: Name or service not known
So two problems appear only in Minikube:
1. All values from appsettings.json become empty
Even though the file exists inside the container, the configuration keys like ConnectionStrings:Default and RabbitMQ, etc are always empty.
2. DNS name postgres-service cannot be resolved even if all values empty
The app tries to connect to
tcp://postgres-service:5432
but Kubernetes cannot resolve this hostname. But all my values are empty why it even throws?
So I need help with this.