The Three Pillars of Observability in Kubernetes (Metrics, Logs, Traces)
Combine metrics, logs, and traces to explain cluster and app behavior.
In plain words
Observability is investigating a city with traffic gauges, camera recordings, and a tracked parcel route rather than only one weather station. The simple Kubernetes rule is: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
Think of it like…
Observability is investigating a city with traffic gauges, camera recordings, and a tracked parcel route rather than only one weather station.
Where you’ve seen it
An SRE testing a diagnosis runs kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services. Expected evidence: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them. If the run instead shows this symptom, stop and restore the last known state: Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency.
Words you’ll hear
- Metrics
- For this lesson, Metrics is the controlling idea: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
- Logs
- Logs is the checkpoint; run
kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/servicesand inspect the owner chain. Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency. - Traces
- Traces is the outcome to preserve; the cost is explicit: Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation.
- Verification evidence
- The evidence command is
kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services. It connects the declaration to this behavior: Combine metrics, logs, and traces to explain cluster and app behavior.
Visual diagram
Theory & deep dive
How Metrics reaches the intended state
Combine metrics, logs, and traces to explain cluster and app behavior. Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
The concrete checkpoint is kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services; compare the Metrics owner, Logs state, and Traces outcome instead of treating YAML acceptance as proof.
Run kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services after the change and correlate the result with Events and the owning object. Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
Logs: failure boundary and production cost
Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency. The prerequisite contract is concrete: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation. A safe design limits blast radius, records the last good configuration, and uses kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services as a deterministic rollback checkpoint.
Capture the current state with kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency.
How it works, step by step
Step 1 of 41. Define the symptom and SLI
Turn the user symptom into a measurable question and select a telemetry source: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
- Goal
- Combine metrics, logs, and traces to explain cluster and app behavior.
- Owner
- Metrics
When to use it & trade-offs
What it is
Combine metrics, logs, and traces to explain cluster and app behavior. Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
Why it matters: Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency. The invariant at risk is specific: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them. The quickest fact check before changing the design is kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services.
When to reach for it
- Use Metrics to enforce this invariant: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
- Use Logs evidence from
kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/servicesin reviews and incident timelines. Combine metrics, logs, and traces to explain cluster and app behavior. - Choose the managed observability backend route only when this cost is justified by governance or scale: Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation.
When to avoid or be careful
- Avoid assuming Metrics is complete after YAML submission; the required behavior is concrete: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
- Avoid treating the next symptom as random; check the owner and state with
kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/servicesfirst: Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency. - Avoid adopting a heavier platform wrapper before measuring its cost: Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation.
Native, manual, and managed paths for Metrics
kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services.Strengths: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
Watch out: Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation. Recovery must also recognize this signal: Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency.
kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services; the expected invariant is: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.Strengths: kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services gives immediate feedback without first building a platform layer.
Watch out: A manual change can hide drift, and unlike Metrics, it does not make this symptom self-documenting: Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency.
kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services.Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
Watch out: The added platform ownership buys value at this cost: Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation.
Interview signals & numbers to know
When this topic comes up
- Interview anchor: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
- Trace Metrics to Traces through Logs; the invariant is: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
- Recognize the symptom: Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency.
- Justify the cost: Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation.
- Verify with kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services instead of only inspecting YAML.
Benchmarks & rules of thumb
- 3
- telemetry pillars
- 1
- correlation identifier should connect a request across them
- 0
- single metric can explain every causal hop
Common mistakes & follow-ups
Common interview mistakes
- Debugging only the child object misses the Metrics owner contract: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them.
- Ignoring this telltale condition leads to unrelated changes: Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency.
- Repeating
kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/serviceswithout an owner for remediation wastes retry cost. Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation.
Likely interviewer follow-ups
- How would API output and runtime evidence prove this behavior: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them?
- Which owner object, logs, and Events would you inspect for this symptom-Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency-?
- At what threshold would this cost become unacceptable: Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation?
kubectl get servicemonitor,podmonitor -A; kubectl logs deploy/api --tail=50; curl -s http://jaeger:16686/api/services, name the failure, then justify the cost. Invariant: Metrics show rates and aggregates, logs preserve discrete events, and traces show one request's latency and parent-child path across services; correlation IDs and resource labels connect them. Failure: Focusing on CPU while ignoring trace and log context can prove utilization without explaining a user-visible timeout or a failing dependency. Cost: Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation.Knowledge check
Put it into practice
Practice related interview Q&A
Apply The Three Pillars of Observability in Kubernetes (Metrics, Logs, Traces) with generative AI interview Q&A and hands-on practice.