liveBook · Manning

Kubectl logs

A kubectl command that retrieves log output produced by containers in a Kubernetes pod.

How 3 Manning books explain it

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.

Read how Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform explains kubectl logs →

Related concepts

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.