I have a .NET Core MVC web application that is containerized and running in Azure Kubernetes Service. The application uses .NET Core Identities for user authentication.
The problem I have is that when I scale up the application to multiple instances, user authentication becomes unreliable. I believe this is because the load balancer does not guarantee that subsequent requests from the same user session go to the same instance, and as the authentication cookies creating on one instance are not valid on another instance, the user is directed to the login page again.
With the .NET Framework I would set the machineKey in the webconfig, and so multiple instances would be using the same key for encryption.
What is the appropriate way to manage this situation with a .NET Core application?