Metrics logs traces and events
Choose the signal that answers your question
Observability means collecting evidence that helps you explain a system’s behavior. Metrics are numeric measurements over time; logs describe individual occurrences; traces connect work performed across services; Kubernetes Events report noteworthy changes or problems in the cluster. In the bookstore, a slow catalog request can happen while node CPU remains low. Start with a latency metric to find the affected interval, then inspect a trace to locate the slow operation. A log may give its error message. Events can explain a failed scheduling or mount attempt, but cannot describe every application request.
Signal Questionrequest latency How widespread is the slowdown?trace Which operation took time?log What did that operation report?Event Did the scheduler report a placement problem?Read container logs without assuming they are permanent
Applications commonly write to standard output and standard error. The container runtime and kubelet make container logs available to kubectl; this is not a permanent archive. Rotation, replacement, node loss and retention can remove history. Specify the namespace, Pod and container, and restrict time or line count. The previous option can retrieve the prior container instance if retained; it does not recover an arbitrary deleted Pod. Commands below are static examples for an explicitly authorized disposable lab with a separate kubeconfig. The named context, namespace, Pod and container are prerequisites, not resources created by this lesson.
kubectl --kubeconfig ./lab.kubeconfig --context observability-lab -n bookstore-demo logs catalog-example -c catalog --tail=50 --timestampskubectl --kubeconfig ./lab.kubeconfig --context observability-lab -n bookstore-demo logs catalog-example -c catalog --previous --tail=50Interpret Events alongside object status
A FailedScheduling Event can suggest insufficient requested capacity, while Pod conditions and scheduler messages help confirm why a workload is pending. Events are short-lived and best effort; absence is not evidence that no failure happened. Audit logs, if configured, answer a different question about API activity. Compare the affected object UID, time window and condition before associating an Event with a Pod that may have been replaced.
kubectl --kubeconfig ./lab.kubeconfig --context observability-lab -n bookstore-demo get eventskubectl --kubeconfig ./lab.kubeconfig --context observability-lab -n bookstore-demo describe pod catalog-exampleFollow a request through a trace
A trace contains spans, which record units of work with timestamps, attributes and parent relationships. Context propagation lets the catalog service and inventory service participate in the same trace. In our fictional example a 900 ms root span contains a 780 ms inventory child. The child explains much of the elapsed interval, but cannot alone prove why the dependency was slow. Parallel child spans can overlap; adding every duration can exceed the root duration.
catalog GET /books [0–900 ms] inventory lookup [50–830 ms] response encoding [840–880 ms]Practice a bounded investigation
Open lab-fixtures/observability/evidence-cases.json. For each symptom choose the most direct initial evidence, then name a second signal that could confirm or refute your hypothesis. Inspect traces.json and logs.json for the slow request. Do not equate correlation with causation. The data are invented and intentionally incomplete; no command or network request is required.
Further reading and practice
Offline lab: lab-fixtures/observability/README.md. These examples are synthetic; no cluster execution was tested. Selected official sources are listed in the chapter review.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Metrics logs traces and events — knowledge check
Interpret synthetic observability evidence.
Node CPU is normal but a request is slow. Which signal best shows where this request spent time?
Which source is most direct for the reason a Pod could not be scheduled?
What does kubectl logs --previous request?
Two child spans overlap. Can their durations be added to compute root latency?
No Event is retained for a suspected failure. What is justified?