Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 121/ 160
07. Observability, Troubleshooting & SRE

The Three Pillars of Observability in Kubernetes (Metrics, Logs, Traces)

Combine metrics, logs, and traces to explain cluster and app behavior.

BeginnerMetrics · Logs · Traces3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

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/services and 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

Loading interactive 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.

Verify Logs, not only object creation

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.

Key takeaway: Metrics is implemented only when this invariant remains observable: 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.

Recover from Logs drift

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.

Key takeaway: Accept the trade-off consciously: Three pillars answer different questions, but duplicating all raw telemetry increases cardinality, volume, and retention cost without correlation.

How it works, step by step

Step 1 of 4
SRE and service owner

1. 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.

Metrics contract → owned state
Key numbers at this step
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/services in 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/services first: 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

Metrics and evidence-led diagnosis
Best for: Combine metrics, logs, and traces to explain cluster and app behavior. A concrete incident check is 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.

Ad-hoc console inspection
Best for: Quickly testing the Logs assumption with 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.

Managed observability backend
Best for: Teams that need Traces integrated with guardrails; the evidence path is 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/services without 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?
Interview tip: Interview sequence: state the invariant, run 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

Loading quiz

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.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Automated Compliance Reporting & Drift Remediation
Next topic
Prometheus Architecture, ServiceMonitors & PodMonitors