Kubectl logs
A kubectl command that retrieves log output produced by containers in a Kubernetes pod.
Acing the Certified Kubernetes Administrator Exam, Second Edition
kubectl logs is a Kubernetes command for retrieving logs from containers in pods.
- How it is used
- Retrieves container output to diagnose crashing application pods and failing control-plane components.
- How deep it goes
- Works through pod, named-container, and all-container commands, then distinguishes container output from service logs and pod events.
- Examples
- Uses a MySQL CrashLoopBackOff, a two-container BusyBox pod, and a scheduler flag error as diagnostic cases.
- What you can do after
- Diagnose/debug with it by selecting a pod or container, reading its error, making a targeted fix, and checking pod status.
Read how Acing the Certified Kubernetes Administrator Exam, Second Edition explains kubectl logs →
Kubernetes in Action, Second Edition
kubectl logs is a Kubernetes command-line operation that retrieves output streams captured from a container.
- How it is used
- Inspects application output and follows requests across pods without logging into the node hosting them.
- How deep it goes
- Explains captured output, streaming, timestamps, time filters, and multi-pod or multi-container selection, but not log retention.
- Examples
- Demonstrates Kiada startup and request logs, real-time following, timestamps, time windows, tails, and ReplicaSet-wide retrieval.
- What you can do after
- Operate kubectl logs to inspect, follow, filter, and aggregate application output from Kubernetes pods and containers.
Read how Kubernetes in Action, Second Edition explains kubectl logs →
Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform
kubectl logs is a kubectl command that retrieves container logs from a Kubernetes pod.
- How it is used
- Retrieves logs from a named Kubernetes pod to inspect a microservice.
- How deep it goes
- Demonstrates the basic pod-name command, then defers multi-replica and ongoing collection to Stern.
- Examples
- Uses the metadata microservice pod and contrasts kubectl logs with stern metadata.
- What you can do after
- Operate kubectl logs by replacing its pod-name placeholder with an actual Kubernetes pod name.
Related concepts
- poduses · A Kubernetes Pod is the smallest deployable unit in Kubernetes, grouping one or more co-located containers that share networking and other resources.
- loguses · A log is a record of events, activity, or diagnostic information produced during the operation of a system or process, often ordered by time.
- monitoringuses · Monitoring is the ongoing observation and measurement of a system’s behavior, state, or operational signals to assess its condition and detect changes or problems.
- init containeruses · An init container is a Kubernetes Pod container that performs initialization work to completion before the Pod’s application containers start.
- Sternalternative to · Stern is a command-line tool for retrieving and following logs from multiple Kubernetes pods using name or label patterns.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


