- 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 - 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
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
2 answers
Sort by: Most helpful
-
Sergei Li 6 Reputation points
2021-01-22T10:20:24.58+00:00 -
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more