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.
kubectl logs ping-pod
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
Otherwise, we'll see this error. In this case, our ping-pod Pod has two containers, ping-google-container and ping-siliconrepublic-container.