There are a few useful options when getting logs from your Kubernetes pods:

  • tailing
  • showing the last x number of lines
  • combining options

tailing

This will tail and follow the pod’s logs

kubectl -f <pod_name>

Showing the last X number of lines

When a pod has been running for a while, the logs can be very long. You probably only want to see the last few lines.

kubectl --tail=10 <pod_name>

Combining options

You can combine the follow and last x number of lines options

kubectl -f --tail=10 <pod_name>

Contact me if you have any questions about this or want to chat, happy to start a dialog or help out: blogs@managedkube.com {::nomarkdown}

Learn more about integrating Kubernetes apps

{:/nomarkdown}