liveBook · Manning

Standard output

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

Standard output is the conventional output stream through which a process writes normal textual output.

Standard output (stdout) is the normal textual output stream produced by a container process. Kubernetes exposes it through kubectl logs, alongside standard error (stderr), making it a primary path for inspecting container behavior. section 8.1.1

Use container names to inspect standard output in multi-container pods:

  • Run kubectl logs busybox -c busybox to view one container's output. section 8.1.1
  • Run kubectl logs busybox -c sidecar to view the sidecar container's output. section 8.1.1
  • Run kubectl logs busybox --all-containers to combine output from every container in the pod. section 8.1.1

Two containers writing stdout

A BusyBox container repeatedly prints a timestamp and “I am a busybox container”; a sidecar prints its own message. kubectl logs distinguishes their streams with -c. section 8.1.1

root@kind-control-plane:/# kubectl logs busybox -c busybox
Tue Dec  6 14:36:26 UTC 2022: I am a busybox container
Tue Dec  6 14:36:31 UTC 2022: I am a busybox container
Tue Dec  6 14:36:36 UTC 2022: I am a busybox container
Tue Dec  6 14:36:41 UTC 2022: I am a busybox container

Inspect representative stdout lines emitted by the busybox container. section 8.1.1

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Defines stdout and demonstrates retrieval with kubectl logs, but defers stream internals and logging configuration.
Examples
Shows BusyBox and sidecar containers emitting timestamped messages and exposes their output separately or together.
What it assumes
Assumes basic familiarity with Kubernetes pods and containers while demonstrating container selection from zero.
What you can do after
Diagnose container behavior by retrieving selected or aggregated output with kubectl logs.
How it connects
Connects standard output with standard error, containers, pods, and kubectl logs.

Also explained in

Compare how 6 books explain standard output →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.