Home > Back-end >  App pod logs with linkerd | unable to view
App pod logs with linkerd | unable to view

Time:07-30

I was able to view the app container logs using kubectl -f logs and was able to login to the container using "k exec --stdin --tty -- /bin/bash".

After injecting linkerd, I could not login to the container. However my goal is to check the app logs.

When I use this "k logs -f linkerd-proxy" I could not see the app-related logs.

I tried injecting debug-sidecar as well. Tried this - "k logs deploy/ linkerd-debug - " and as well as this "k exec -it -c linkerd-debug -- tshark -i any -f "tcp" -V -Y "http.request"

still I couldn't see the exact logs for my app in the pod. Please suggest.

CodePudding user response:

Linkerd works by injecting an additional container into your pods; this is known as the "sidecar" pattern. Your application (or better said container) logs are still accessible, however, as a result of having more than one container in the pod, kubectl requires you to explicitly specify the container name.

For example, assuming you have a pod with two containers (linkerd-proxy and app), you'd have to specify app as the name of the container:

$ kubectl logs -f <pod-name> -c app
# You can specify the container name without the -c flag
$ kubectl logs -f <pod-name> app
# This will work for 'exec' too
$ kubectl exec <pod-name> -c app -it -- sh
  • Related