Redis stack trace does not appear in Kubernetes Pod Log! Why not?

Siegfried Heintze 1,861 Reputation points

I have an ASP.NET core 3 web app I'm trying to debug in an Azure Kubernetes pod.

I could look at the kubernetes pod log and see my System.Console.WriteLine statements inside of my ConfigureServices functions and everything looked great -- including my WriteLine statement indicating that I had called AddDistributedRedisCache that should use the bitnami redis server.

However my web app was failing and I could not figure out why until I tried out the kubernetes bridge. There I saw the little console window pop up where all my WriteLine statements manifested AND the stack trace indicating the failure to connect with the Redis server... Ah hah!

Previously there were no helpful error messages except the standard message in the browser telling me to turn on developer mode to see more details. Apparently this is not possible for kubernetes resident apps to run in developer mode in spite of explicitly calling app.UseDeveloperExceptionPage();.

The problem was fixed by creating a Redis service in the same name space as my web app...

Why did this redis stack trace not appear in the kubernetes pod log? Perhaps the stack trace writes to stderr and maybe the kubernetes pod log only picks up stdout? Is there kubernetes setting to change this?

Maybe there is an ASP.NET call to make everything appear in stdout so it can be seen in the kubernetes pod log?

Is this a kubernetes issue or an ASP.NET issue?



A set of technologies in the .NET Framework for building web applications and XML web services.
4,283 questions
Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
224 questions
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,931 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sergei Li 1 Reputation point
    1. Answering your main question. There is a chance that your pod consists of more than one container. In this case, you need to specify the container name:
      kubectl logs my-pod -c my-container
    2. As for moving a Redis service into the same namespace as your webapp. You could have avoided that by using the correct service DNS name which includes the name of the Redis namespace:
      The full version is