Menu
Coddy logo textTech

Pod Logs

Part of the Introduction to Kubernetes section of Coddy's Terminal journey. Lesson 21 of 45.

Whatever a container prints is collected by Kubernetes. Read it back with the Pod's name:

kubectl logs web

For an nginx Pod that is the server's start-up messages; for your own application it is whatever it writes to its output. Logs are the first thing to check when a Pod does not behave.

A Deployment's Pods have generated names, so you can name the Deployment instead and kubectl picks one of its Pods:

kubectl logs deployment/web

Add --tail=5 to see only the last five lines.

Logs are kept as long as the Pod exists, even after its container has exited: that is how you find out why something stopped.

challenge icon

Challenge

Beginner

Start a Pod named web from the nginx image, then print its logs to see the server start up.

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Introduction to Kubernetes

Practice on your own: Terminal playground