View logs with kubectl.
TODO: collapasable, copyable, download, etc
With kubectl how can I look at the logs for a container named app-ui-5558d88df-dpcnq
?To view the logs for a container named app-ui-5558d88df-dpcnq
using kubectl
, you would use the logs
command followed by the name of the pod. If app-ui-5558d88df-dpcnq
is the name of the pod, and it contains only one container or you want to view the logs of the default container, you can simply execute:
kubectl logs app-ui-5558d88df-dpcnq
However, if the pod contains multiple containers and you want to specify which container's logs to view, you need to use the -c
or --container
flag followed by the name of the container. Assuming the container is also named app-ui-5558d88df-dpcnq
or you have a specific container name, replace container_name
with the actual name of the container in the pod:
kubectl logs app-ui-5558d88df-dpcnq -c container_name
Make sure to replace container_name
with the actual name of the container within the pod if it's different from the pod name and you are targeting a specific container.
Related Chats
Identifying Host Deploying Node 0.512
Debugging Docker SvelteKit Logs 0.417
Node.js Log Options 0.382
Env File for Docker 0.360
Switch to EKS: Steps 0.354
Dockerfile for MySQL 8.0.34 0.348
Winston Logging Configuration 0.322