I run an .NET Core 2.1
in a container. It writes logs to a file within the container. I am able to run a docker exec bash
command to inspect the log file, locally.
This application is then deployed with Kubernetes
to a pod with more than one container.
How can I inspect the log file within each one of these containers?
You can exec into container within pod:
kubectl -n <namespace> exec -it <pod name> -c <container name> bash
But the better approach is to make your application stream logs to stdout or stderr, so you can access it directly with:
kubectl -n <namespace> logs <pod name> -c <container name>