question

SiegfriedHeintze-9929 avatar image
0 Votes"
SiegfriedHeintze-9929 asked SiegfriedHeintze-9929 commented

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


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?

Thanks


Siegfried

dotnet-aspnet-core-generalazure-kubernetes-serviceazure-cache-redis
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Working with SiegfriedHeintze-9929 offline!!!


0 Votes 0 ·

1 Answer

SergeiLi-8092 avatar image
0 Votes"
SergeiLi-8092 answered SiegfriedHeintze-9929 commented
  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: my-svc.my-namespace
    The full version is my-svc.my-namespace.svc.cluster-domain.example






· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I did not know I had a container or two within the pod...
OK, I found this: list-all-containers-in-a-single-pod-in-kubernetes. Please give me a little more time to try this out.


0 Votes 0 ·

OK, perhaps I deleted my comment by accident? And then I replied to a deleted comment and that is now deleted too? Can anyone see my deleted comments (and deleted comment replies)?

So I enumerated the containers and there is only one... So I still don't know how to make that stack trace appear...

Thanks

Siegfried

0 Votes 0 ·