Ali Ilman
Ali Ilman

Ali Ilman

Printing Logs of a Container

Printing Logs of a Container

In Kubernetes, we can use the kubectl logs command to print logs of a container. The command accepts a -f flag to print live logs.

Single-container Pods

kubectl logs ping-pod

Screenshot 2020-11-08 at 22.05.16.png

Multi-container Pods

For multi-container pods, we need to pass in the name of the container who's logs we want to print.

kubectl logs ping-pod ping-siliconrepublic-container

Screenshot 2020-11-08 at 22.14.38.png

Otherwise, we'll see this error. In this case, our ping-pod Pod has two containers, ping-google-container and ping-siliconrepublic-container.

Screenshot 2020-11-08 at 22.12.01.png

 
Share this