1

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.

1
  • Do you perhaps have a appsettings.<environment>.json that uses an environment name which you use for the Minikube instance? Commented Nov 17 at 10:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.