After this lesson, you will be able to: Read Pod logs effectively, install Prometheus + Grafana for metrics, and understand the role of distributed tracing.
Observability is what makes K8s operable. Without metrics + logs + traces, you can't tell why an app is slow at 3am.
kubectl logs gets you started; production needs aggregation.
# Single Pod logskubectl logs <pod>kubectl logs <pod> -c <container> # multi-container Podkubectl logs <pod> --previous # logs from prior crashkubectl logs -f <pod> # follow# Across many Podskubectl logs -l app=myapp --tail=200kubectl logs -l app=myapp -f --max-log-requests=20# stern (the better multi-Pod log tool)brew install sternstern myapp # follow logs across all Pods with 'myapp' in namestern myapp -n production --since 5m# For production: ship logs to Loki / CloudWatch / Datadog / Elastic.# Apps should log JSON to stdout; a log shipper (Promtail, Fluent Bit) does the rest.
Prometheus scrapes metrics from your Pods (via /metrics endpoints) and stores them. kube-state-metrics + node-exporter provide cluster + node metrics. Grafana visualizes them. The kube-prometheus-stack Helm chart bundles all of this. Apps expose metrics in Prometheus format: counters (requests_total), gauges (memory_usage_bytes), histograms (request_duration_seconds_bucket).
One command. Adds Prometheus + Grafana + AlertManager.
helm repo add prometheus-community https://prometheus-community.github.io/helm-chartshelm repo updatehelm install kube-prometheus prometheus-community/kube-prometheus-stack \--namespace monitoring --create-namespace# Access Grafanakubectl port-forward -n monitoring svc/kube-prometheus-grafana 3000:80# Browse http://localhost:3000 (default admin/prom-operator)# Default dashboards: cluster overview, namespaces, nodes, workloads.# Add your own metrics by exposing /metrics on your app and creating a ServiceMonitor.
Distributed tracing connects 'this request' across many services. Each service adds a span; the result is a flame graph showing where time was spent. OpenTelemetry is the modern standard (instrumentation SDK, backend-agnostic). Backends: Jaeger, Tempo, Honeycomb, Datadog. When to add it: when one user request spans 3+ services and 'where's the latency?' is the daily question. Don't bother before that.
Logging non-JSON to stdout. Aggregators struggle to parse free-form text. Skipping metric labels (`app=myapp, env=prod`). Without them, dashboards mix data. Cardinality explosions (high-cardinality labels like user_id in metrics). Crashes Prometheus. Alerting on every WARN log. Drowns the on-call. Skipping runbooks. An alert without 'here's what to do' is half useful.
Pick the most useful diagnostic.
Sign in and purchase access to unlock this lesson.