Home > Back-end >  Not able to load Kubernetes logs
Not able to load Kubernetes logs

Time:11-03

I'm running an AKS (Azure Kubernetes Service) cluster, but now when try to reach the logs I'm getting the issue below, which is weird because I wasn't facing it.

Issue:

kubectl logs -n default hello-display-759947d684-782n5
2021/11/02 08:11:04 Failed to read tracing config, using the no-op default: empty json tracing config

Expected behavior:

I expect the logs to be displayed.

Additional information:

kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.5", GitCommit:"aea7bbadd2fc0cd689de94a54e5b7b758869d691", GitTreeState:"clean", BuildDate:"2021-09-15T21:10:45Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.9", GitCommit:"ed93e7ea8f833824d05578765c2ad3efbebbfebe", GitTreeState:"clean", BuildDate:"2021-10-21T03:31:08Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"linux/amd64"}

Thank you in advance.

CodePudding user response:

I would not consider that an issue, but a warning. That hello-display seems to be using the Knative library that you can find here:

If you want to configure observability without falling back to defaults, you should add those items environment variables to that hello-display, which is usually done by reading a ConfigMap. For reference, you can find the default config being used at the core eventing components here.

CodePudding user response:

It sounds like kubectl is handing you the logs from the queue-proxy container installed by Knative, rather than the user-container. Try this command:

kubectl logs -n default hello-display-759947d684-782n5 -c user-container

Alternatively, AKS may have a centralized log service which you can use to view the logs for current and past pods, which should allow you to select which container you're viewing.

  • Related