Observability
Study Guide
observability namespace, two Helm charts.📖 Table of Contents
observability namespace · two Helm charts (kube-prometheus-stack + loki-stack) · one shared label model gluing it all together.🗺️ The Map — The Whole Route
Before diving into any tool, here's the whole story — every sentence is a link to its chapter.
We begin in Part 1 — What is Observability?: the ability to understand what's happening inside a system from the data it produces — without shipping new code to ask a new question — through four pillars: Logs, Metrics, Traces, and Visualization. Then Part 2 puts the three signal types side by side — the single most exam-worthy table in this book — and Part 2·b introduces the deployed stack component by component.
Logs first: Part 3 — Why Loki? (10–20× cheaper — it indexes labels, not text), Part 3·b the write/read path pipeline (Distributor → Ingester → Store ← Querier), and Part 3·c Promtail's DaemonSet workflow: Discover → Tail → Label → Ship.
Metrics: Part 4 — Prometheus (pull model, time series, PromQL, service discovery) and Part 4·b the four metric sources: node-exporter, kube-state-metrics, cAdvisor, ServiceMonitor/PodMonitor CRDs. Then Part 5 — Traces (the natural next step) and Part 6 — Grafana, the memoryless unified UI.
Everything practical: Part 7 the complete data flow · Part 8 the Helm deployment · Part 8·b the datasource conflict gotcha + port-forward · Part 9 LogQL & PromQL · Part 10 app integration · Part 11 the troubleshooting playbook · cleanup · Part 13 the architecture mental model · the terms glossary · Part 14 interview prep, cheat sheet & quiz. The route is clear. ▶
Grafana is the pane of glass where all of this comes together — because Loki uses the exact same label model as Prometheus and Kubernetes, you can pivot from a metric on a pod straight to that pod's logs.
👁️ What is Observability? — The Four Pillars
Observability is the ability to understand what is happening inside a system by examining the data it produces — without having to ship new code to ask a new question. It relies on four core pillars:
Discrete, timestamped records of events — the error, the warning, the startup message.
Numeric measurements over time — CPU, requests per second, response latency.
The full path a single request takes as it moves across the different services.
Turns raw signals into dashboards a human can read and act upon.
The first three pillars produce and store the signals — the fourth makes them understandable and actionable.
⏭️ How do the pillars become actual components? → Part 2: Logs vs Metrics vs Traces
⚖️ Logs vs Metrics vs Traces
The three signal types are complementary, not redundant. This table is the single most exam-worthy artifact in this guide:
| 📜 Logs | 📈 Metrics | 🔗 Traces | |
|---|---|---|---|
| Question | What happened, and what did it say? | How much, how fast, how often? | Where did the time go? |
| Nature | Discrete, timestamped event records | Numeric measurements over time | Full journey of one request across services |
| Shape | Free-form text lines | Time series (name + labels + values) | Request path through service hops |
| Stored by | Loki | Prometheus | Not deployed in this lab (Tempo / Jaeger / Zipkin would be) |
| Query language | LogQL | PromQL | (trace UI) |
| Best for | Reading the exact content of an event ("show me the stack trace") | Trends, rates, aggregation, alerting, dashboards | Latency breakdown across a multi-service request |
Grafana is the pane of glass where all of this comes together.
pod X, namespace Y in a Prometheus panel → query {namespace="Y", pod="X"} in Loki → read the logs from exactly that window. Zero extra configuration produces this.⏭️ Now meet the components that store these signals → Part 2·b: The Core Stack
🧱 The Core Stack — At a Glance
| Component | Role | Installed by | Runs as |
|---|---|---|---|
| 📜 Loki | Stores and indexes logs | loki-stack | Log backend |
| 📜 Promtail | Tails container logs on every node and ships them to Loki | loki-stack | DaemonSet |
| 📈 Prometheus | Scrapes and stores metrics as time series | kube-prometheus-stack | Metrics backend |
| 🖥️ node-exporter | Exposes host-level metrics | kube-prometheus-stack | DaemonSet |
| 📦 kube-state-metrics | Exposes Kubernetes object state metrics | kube-prometheus-stack | Deployment |
| 🚨 Alertmanager | Routes PromQL alert conditions to Slack/email/PagerDuty | kube-prometheus-stack | DISABLED IN THIS LAB |
| 📊 Grafana | Queries both backends, renders dashboards | kube-prometheus-stack | Deployment |
kube-prometheus-stack, not standalone — this exact fact causes the datasource conflict in Part 8·b.⏭️ Starting with the first pillar: why Loki specifically? → Part 3
📜 Why Loki? — The Philosophy & the Differences
Loki is a horizontally-scalable, multi-tenant log aggregation system built by Grafana Labs. It stands apart from full-text systems like ELK for four essential reasons:
💰 Cost-Effective — the cheapest
10–20× cheaper for storage, because Loki indexes only metadata (labels) — not the full text of every log line. Light indexing = light storage bill.
🗄️ Storage — cheap tiers
Logs are compressed into chunks and stored in cheap object storage (or a local filesystem in labs) — no massive search nodes needed.
🔍 Querying — LogQL
You query Loki with LogQL — a language deliberately designed to be similar to PromQL. Learn one and the other feels familiar.
🔗 Integration — native fit
Native Grafana integration (no separate UI needed), and it uses the exact same label model as Kubernetes and Prometheus.
⏭️ How does Loki work internally? The write and read paths: → Part 3·b
🏗️ Loki Architecture — Write Path & Read Path
3-AThe five-stage pipeline
Logs travel through Loki's architecture along a specific path — writes flow down the pipeline, reads come back from the Store:
WRITE: container log files → Promtail → Distributor → Ingester → Store · READ: Grafana —LogQL→ Querier → reads chunks + index from Store/Ingester
| Component | Job |
|---|---|
| 1. Promtail | Ships logs from the nodes |
| 2. Distributor | Validates and hashes the incoming log streams |
| 3. Ingester | Batches the streams into chunks and writes them |
| 4. Store | Stores the chunks and the index (object storage or local disk) |
| 5. Querier | Executes the LogQL queries coming from Grafana |
⏭️ The component that feeds stage 1 — why it's a DaemonSet: → Part 3·c: Promtail
🚚 Promtail Workflow — Why a DaemonSet + the 4 Steps
Promtail runs as a DaemonSet — one pod per Kubernetes node. Why? Because container logs are files on each node's local filesystem. A Promtail pod on node A physically cannot read node B's /var/log/pods. Node-local data ⇒ node-local collector.
1️⃣ Discover
Uses Kubernetes service discovery to find every pod running on its node.
2️⃣ Tail
Reads container log files directly from /var/log/pods — like a tail -f.
3️⃣ Label
Attaches K8s metadata as labels: namespace, pod, container, node.
4️⃣ Ship
Batches log lines and pushes to Loki's distributor over HTTP.
pod X, namespace Y in a Prometheus panel → query {namespace="Y", pod="X"} in Loki → read the logs from exactly that window. Zero extra configuration produces this.user_id) as labels. Keep it to stable, structured ones: namespace, app, pod, container, node./var/log/pods) · Steps: Discover → Tail → Label (same K8s labels as Prometheus) → Ship (HTTP push) · Shared labels = free log↔metric correlation.⏭️ From logs to metrics: → Part 4: Prometheus
📈 Prometheus — Fundamentals
Prometheus is an open-source monitoring system that uses a pull model: it scrapes metrics from targets on a regular interval, rather than waiting for applications to push data.
🗄️ Storage
Every measurement is a Time Series: a metric name + key/value labels + a sequence of timestamped values. Example: container_cpu_usage_seconds_total{namespace="app", pod="api-7d9f"} — labels are the dimensions you aggregate by.
🔍 Querying — PromQL
A powerful query language for aggregating, filtering, and computing rates over time series.
🚨 Alerting — Alertmanager
Pairs with Alertmanager to turn PromQL conditions into routed alerts — Slack, Email, PagerDuty. (Disabled in this lab — but the concept stands.)
/metrics endpoint, nothing more.up metric goes to 0. A target that won't respond to a scrape = down. You can literally query whether monitoring works.Nobody maintains a list of pod IPs — pods are ephemeral anyway; the list would be stale in minutes.
up == 0.⏭️ Where do the metrics actually come from? → Part 4·b: The Metric Sources
🛰️ Metric Sources — Know Who Exposes What
| Component | Where it runs | What it exposes | The question it answers |
|---|---|---|---|
| 🖥️ node-exporter | DaemonSet (one pod per node) | Host-level metrics: CPU, memory, disk, network | "Is the machine itself healthy?" |
| 📦 kube-state-metrics | Watches the Kubernetes API | Object state: pod status, deployment replicas, restarts | "Does Kubernetes think everything is fine?" |
| ⚙️ cAdvisor | Built into the kubelet | Per-container resource usage (actual CPU/memory each container consumes) | "Which container is eating resources?" |
| 🎯 ServiceMonitor / PodMonitor | CRDs — not pods at all | Declarative rules for which Services/Pods Prometheus should scrape | "How does Prometheus find my app?" |
⏭️ The third pillar: the journey of a single request → Part 5: Traces
🔗 Traces — The Journey of a Request
A trace records the full journey of a single request as it moves through multiple services:
The trace reveals instantly: most of the time went to the DB Query — no guessing, no manually checking every service.
5.1The purpose
Traces show exactly where time was spent during a request. Metrics tell you that requests are slow; traces tell you which hop made them slow — which service was slow, which call repeated, where the real bottleneck lives.
5.2The tools
Tracing typically uses Grafana Tempo, Jaeger, or Zipkin, with applications instrumented via OpenTelemetry.
⏭️ The fourth pillar: the window into everything → Part 6: Grafana
📊 Grafana — The Unified UI
Grafana is the unified UI for observability — the pane of glass where logs and metrics meet.
🔌 Data Handling
Grafana does not store data itself — it connects to Data Sources (Prometheus, Loki) and queries them live on every panel refresh. Wipe the backends and Grafana has nothing to show — it's a lens, not a database.
⚙️ Configuration
Each Data Source requires: a URL + authentication + the query language it should speak (PromQL or LogQL).
📊 Dashboards & Panels
A Dashboard is a collection of Panels. Each panel runs a query and renders it as a graph, table, log stream, or gauge. Dashboards are JSON — version-controlled, or imported from grafana.com/dashboards by numeric ID.
🔍 Explore Mode
Run ad-hoc PromQL or LogQL queries without building a dashboard — the go-to tool for debugging ("just show me the errors from that namespace right now").
kube-prometheus-stack, not deployed standalone. That fact is exactly what causes the datasource conflict in Part 8·b — the single best "bug I debugged" story in this guide.⏭️ All the pieces are ready — how do they fit together in Kubernetes? → Part 7
🧩 How It All Fits Together — in Kubernetes
- Application pods write logs and (optionally) expose
/metrics. - On every node, Promtail (DaemonSet) tails
/var/log/pods, labels each line with Kubernetes metadata, and pushes batches to Loki's distributor. - On every node, node-exporter (DaemonSet) exposes host metrics; cAdvisor (in the kubelet) exposes per-container metrics; kube-state-metrics exposes object state.
- Prometheus pulls all of those metrics on a scrape interval, discovering targets via Kubernetes service discovery and CRDs (ServiceMonitor/PodMonitor).
- Grafana holds both as data sources and queries Prometheus (PromQL) and Loki (LogQL) live.
- You open Grafana in a browser through a port-forward tunnel and see everything.
But both carry the same labels — namespace / pod / container / node — which is what makes the stack feel like one system.
ClusterIP Service — reachable only from inside the cluster. From your laptop you reach it via kubectl port-forward (full command + decode in Part 8·b).⏭️ Time to actually deploy this — with two Helm commands: → Part 8: Deployment
🚀 Helm + kube-prometheus-stack
Helm is a package manager for Kubernetes. It bundles all necessary manifests — Deployments, Services, ConfigMaps, CRDs — into "charts." Installing a chart creates a release. Charts live in repositories you add to your host. Instead of dozens of hand-written YAML files, two Helm commands deploy the entire platform — including default dashboards and wired-up data sources. Helm turned a week-long project into two commands.
Pending because the scheduler can't fit their requests anywhere. You must drastically trim resource requests and limits for every component with --set flags:| Override | Why |
|---|---|
| Resources trimmed (every component) | Chart defaults assume beefy nodes; Minikube pods go Pending otherwise |
retention=6h | TSDB storage grows with retention; a lab needs no history — 6h is plenty for debugging |
alertmanager.enabled=false | No alert routing needed in a lab → fewer pods, less RAM |
adminPassword=admin123 | The lab's Grafana credentials (admin / admin123) |
helm upgrade --install, never plain helm install. helm upgrade --install is safe to re-run: if the release exists it upgrades in-place; if not, it installs. Plain helm install fails on a second run.Pending · retention 6h saves disk · helm upgrade --install = idempotent.⏭️ Chart 2 — and the one non-obvious gotcha: → Part 8·b
⚠️ loki-stack + The Gotcha + Port-Forward
loki-stackships its own Grafana data-source ConfigMap for Loki.- The Grafana sidecar (in the Grafana installed by
kube-prometheus-stack) auto-discovers datasource ConfigMaps and loads them — Loki appears with zero manual config. Nice. - The conflict:
kube-prometheus-stackmarks Prometheus as the default datasource.loki-stackalso tries to mark Loki as default. - Grafana allows exactly one default datasource. Two defaults = "Datasource provisioning error" → Grafana crashes → restarts → crashes →
CrashLoopBackOff.
--set grafana.sidecar.datasources.defaultDatasourceEnabled=false — Loki still becomes a datasource, just not the default (Prometheus stays default).kubectl get configmap -n observability → find the extra datasource ConfigMap → remove isDefault: true → restart the Grafana pod.| Piece | Meaning |
|---|---|
svc/kube-prometheus-stack-grafana | The Service to tunnel to |
-n observability | The namespace the Service lives in |
3000:80 | local port 3000 → Service port 80 |
--address 0.0.0.0 | Bind on all host interfaces, not loopback only — required on Windows/WSL, otherwise connection refused from the Windows side |
defaultDatasourceEnabled=false · Grafana is ClusterIP → port-forward with --address 0.0.0.0 on WSL → admin/admin123 · Import dashboards 13639 / 12611.⏭️ The stack is up — now query it: → Part 9: LogQL
🔍 LogQL — Querying Loki
Framing: two backends, two query languages, one UI. LogQL was deliberately designed to be similar to PromQL, and both select by the same labels — learn one, and the other feels familiar.
1️⃣ Stream selector
Labels — indexed, fast. Picks which log streams to read.
2️⃣ Filter pipeline
Line filters — evaluated at query time on the matched streams.
3️⃣ Metric wrapper
Turns log counts into numbers — logs become a metric.
count_over_time over a [5m] range) — structurally a sibling of PromQL's rate(), and the bridge between the two signal types.|= keep, != drop · count_over_time(...[5m]) turns error lines into a per-pod rate.⏭️ The other half of the pair: → Part 9·b: PromQL
📈 PromQL — Querying Prometheus
⏱ [5m] = a range vector
Selects many points over 5 minutes — functions like rate() require a range. A single instant value can't produce a rate.
🧮 sum by (pod) = aggregation
Aggregates across labels, keeping pod as the grouping dimension — the same labels Loki uses, so results line up across both backends.
sum by (pod) grouping works on both sides — a per-pod error rate from Loki lines up exactly with a per-pod CPU rate from Prometheus in adjacent Grafana panels.up = scrape health · rate(counter[5m]) needs a range vector · sum by (pod) keeps the grouping label · cAdvisor → container metrics · node-exporter → node_* metrics.⏭️ Getting your own app into the picture: → Part 10: App Integration
🔌 Application Integration
- The app must expose a
/metricsendpoint on anhttpport (client libraries exist for every major language, publishing counters/gauges/histograms in Prometheus format). - Create a
ServiceMonitorCustom Resource whose label selector matches your application — Prometheus discovers it through the CRD (Helm/operator auto-wires the rest).
selector.matchLabels
Finds the app's Service.
endpoints.port
Refers to the Service port name — hence "on an http port."
release label
What the operator's discovery matches on — the "auto-wiring" Helm provides.
up{namespace="default"} in Explore — your app should appear with value 1 within a scrape interval or two.release: label connects the CRD to the operator · Verify with up{namespace="default"} == 1.⏭️ When things go wrong — the playbook: → Part 11: Troubleshooting
🛠️ Troubleshooting Playbook — Scenarios 1–3
Reason from symptom → diagnosis → root cause → fix. The diagnostic command sequence matters more than memorizing fixes.
🔴 Scenario 1 — Pods stuck in Pending
| Symptom | kubectl get pods -n observability → pods sitting in Pending, not starting |
| Diagnose | kubectl describe pod <pod> -n observability → events show FailedScheduling: Insufficient cpu / memory |
| Root cause | Cluster lacks free CPU/memory — the chart's default resource requests don't fit on the Minikube node, and the scheduler will not place a pod whose requests don't fit |
| Fix | LOWER REQUESTS (the --set overrides from Part 8) or GROW MINIKUBE (--cpus=... --memory=...) |
| Lesson | Pending = scheduling problem = look at requests vs available before anything else |
🔴 Scenario 2 — Grafana OOMKilled
| Symptom | Grafana restarts repeatedly; kubectl describe pod shows OOMKilled (exit code 137) |
| Root cause | The container ran out of memory — it exceeded its own memory limit |
| Diagnose first | Check the node's free memory first (kubectl top nodes) — do not blindly raise the Grafana limit |
| Fix | Node has headroom → RAISE LIMIT via --set; node exhausted → FREE CAPACITY (disable components, trim pods, grow Minikube) |
| Lesson | OOMKilled = limit problem; node exhaustion = capacity problem. Diagnose which one you have. |
🔴 Scenario 3 — Grafana CrashLoopBackOff with a provisioning error
| Symptom | Grafana cycles CrashLoopBackOff; logs show "Datasource provisioning error." |
| Diagnose | kubectl logs <grafana-pod> -n observability · kubectl get configmap -n observability → two datasource ConfigMaps, both marked default |
| Root cause | Two datasources marked default — Grafana permits exactly one; provisioning fails at startup every time → crash loop. Not a resource problem — a config validation failure can crash-loop a perfectly sized pod. |
| Fix | Prevent: install loki-stack with defaultDatasourceEnabled=false · Repair: remove isDefault: true from the extra ConfigMap, then kubectl delete pod (Deployment recreates it clean) |
| Lesson | Read the crash logs — the error names the subsystem (provisioning), which points straight at ConfigMaps. This is the star interview story. |
🛠️ Scenarios 4–5 + Cleanup
🔴 Scenario 4 — "Connection refused" from Windows / WSL
| Symptom | Browser on Windows can't reach localhost:3000 even though port-forward is running |
| Root cause | The forward was bound to loopback inside the WSL VM only — the --address 0.0.0.0 flag was missing |
| Fix | RE-RUN FULL COMMAND kubectl port-forward --address 0.0.0.0 -n observability svc/kube-prometheus-stack-grafana 3000:80 |
| Lesson | On WSL, your browser and your cluster live on different network boundaries — bind all interfaces so the port relay works |
🟠 Scenario 5 — "Grafana shows no data" (general reasoning flow)
Work the chain in order — the boring causes are the common ones:
- Is the backend pod running? →
kubectl get pods -n observability(a crashed Loki or Prometheus means no queries can succeed). - Is the datasource alive? → Explore → run
up(Prometheus) or{namespace="observability"}(Loki). If Explore works but a dashboard doesn't, the problem is the dashboard's query/time-range — not the stack. - Missing app metrics specifically? → no
/metricsendpoint, or the ServiceMonitor selector doesn't match — checkupfor the target. - Right namespace? Right time range? → always worth a glance.
12Cleanup — removing the entire stack
kube-prometheus-stack installed are cluster-scoped and may remain after uninstall. Delete them explicitly if you want a spotless cluster.--address 0.0.0.0 · "No data" chain: backend pod → datasource (Explore) → app target → namespace/time-range · Cleanup: two helm uninstalls + delete namespace (+ cluster-scoped CRDs by hand).⏭️ Now zoom out — the whole system on one page: → Part 13: The Mental Model
🗺️ The Mental Model — Architecture on One Page
/metrics endpoint + ServiceMonitor. Both systems speak the same label language (namespace/pod/container/node). Grafana stores nothing — it queries both backends live (PromQL/LogQL) and renders them for humans. You reach Grafana from your laptop through a port-forward because its ClusterIP isn't externally reachable.📇 Quick Revision — The Terms Table
Every term in this book, one line each. If you can define all of these without looking — you're ready.
| Term | One-line definition |
|---|---|
| Observability | Understanding system state from its own data — without shipping new code to ask a new question |
| Log | Discrete, timestamped event record — "what happened, and what did it say" |
| Metric | Numeric measurement over time — "how much, how fast, how often" |
| Trace | Full journey of one request across services — "where did the time go" |
| Visualization | Dashboards turning raw signals into something a human can act on |
| Loki | Log aggregation backend; indexes labels only, stores compressed chunks |
| Promtail | DaemonSet tailing /var/log/pods on every node; pushes to Loki |
| Distributor | Validates & hashes incoming log streams |
| Ingester | Batches streams into chunks and writes them |
| Store | Keeps chunks + index (object storage or disk) |
| Querier | Executes LogQL queries coming from Grafana |
| Log Stream | A unique combination of labels — every distinct label set is its own stream |
| LogQL | Loki's query language: stream selector → line filters → metric wrapper |
| Chunk | Compressed batch of log lines in object storage / disk |
| Term | One-line definition |
|---|---|
| Prometheus | Pull-based metrics backend storing time series |
| Pull Model | Prometheus scrapes targets on an interval; dead target = up 0 |
| Time Series | Metric name + key/value labels + timestamped values |
| PromQL | Prometheus query language — aggregation, filtering, rates |
| Alertmanager | Routes PromQL alert conditions to Slack/email/PagerDuty (disabled here) |
| node-exporter | DaemonSet exposing host-level metrics — the machine layer |
| kube-state-metrics | Watches the K8s API — object state: replicas, restarts |
| cAdvisor | Built into the kubelet — per-container CPU/memory usage |
| ServiceMonitor | CRD declaring which Services/Pods Prometheus scrapes |
| Grafana | Unified UI; stores nothing — queries data sources live |
| Data Source | URL + auth + query language (PromQL or LogQL) in Grafana |
| Dashboard / Panel | A dashboard is a collection of panels; each renders one query |
| Helm | K8s package manager: charts → releases from repositories |
| DaemonSet | One pod per node — for node-local collectors |
| port-forward | Tunnels a ClusterIP Service to localhost (--address 0.0.0.0 on WSL) |
| Pending · OOMKilled · CrashLoopBackOff | The three failure states: scheduling / memory limit / startup crash |
🎤 Concept Questions — with Distilled Answers
Understanding what's happening inside a system from the data it produces — without shipping new code to ask a new question. Pillars: logs, metrics, traces, visualization.
Logs = what happened (exact events). Metrics = how much/how fast (trends, alerting). Traces = where the time went (per hop). Debug flow: alert → trace → log.
It indexes only metadata (labels), not log text; text is searched at query time. Chunks are compressed into cheap object storage.
Prometheus pulls (scrapes on an interval — central cadence control; dead target visible via
up=0). Promtail pushes HTTP batches to Loki's distributor.Their data is node-local: container logs live in each node's
/var/log/pods; host metrics are per-machine. One pod per node = full coverage.A metric name + key/value labels + a sequence of timestamped values.
Host-level machine metrics (DaemonSet) vs K8s object state from the API server (pod status, replicas, restarts) vs per-container usage built into the kubelet.
CRDs that declaratively tell Prometheus which Services/Pods to scrape — no manual IP lists; deploying the CRD is the config (Helm auto-wires it).
helm upgrade --install over helm install?Idempotency — re-running upgrades an existing release in place instead of failing.
Grafana is ClusterIP (internal only). Port-forward = zero-config lab access; NodePort/LB/Ingress expose it properly. On Windows/WSL you must pass
--address 0.0.0.0.TSDB storage grows with retention; a lab needs no history — 6h saves significant disk.
Same label model — Promtail attaches the exact labels Prometheus uses (namespace/pod/container/node), so a metric anomaly maps directly to that pod's log stream.
Traces — deploy Grafana Tempo (or Jaeger/Zipkin), instrument apps with OpenTelemetry — completing all three signals.
Grafana
CrashLoopBackOff with a datasource provisioning error: both charts provisioned a datasource marked default; Grafana allows exactly one. Diagnosed via pod logs + kubectl get configmap; fixed by grafana.sidecar.datasources.defaultDatasourceEnabled=false (or removing isDefault: true).📌 Command Cheat Sheet
| Command | What it does / tells you |
|---|---|
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | Add chart repo |
helm repo add grafana https://grafana.github.io/helm-charts | Add chart repo |
helm repo update | Refresh repo indexes |
kubectl create namespace observability | Dedicated namespace for the stack |
helm upgrade --install <release> <chart> -n observability --set ... | Idempotent install/upgrade |
helm list -n observability | Installed releases |
helm uninstall <release> -n observability | Remove a release |
kubectl get pods -n observability | First health check: Running / Pending / CrashLoopBackOff |
kubectl describe pod <pod> -n observability | Events: FailedScheduling, OOMKilled, restart reason |
kubectl logs <pod> -n observability | App-level errors (the provisioning error lives here) |
kubectl get configmap -n observability | Find datasource provisioning ConfigMaps |
kubectl top nodes / kubectl top pods -n observability | Actual CPU/memory vs requests |
kubectl delete pod <pod> -n observability | Force a clean restart (e.g., after ConfigMap fix) |
kubectl port-forward --address 0.0.0.0 -n observability svc/kube-prometheus-stack-grafana 3000:80 | Access Grafana at localhost:3000 |
get pods → describe pod → logs → get configmap → top nodes/pods. Every scenario in Part 11 uses some subset of exactly these five.🧪 Self-Quiz + Answer Key
--set fix?up == 0 mean?--address 0.0.0.0 on Windows/WSL?- The Distributor (then the Ingester batches streams into chunks; the Store keeps chunks + index).
/var/log/podson its node; Promtail runs as a DaemonSet — one pod per node, because logs are node-local files.- Metric name + key/value labels + a sequence of timestamped values.
- cAdvisor, built into the kubelet.
- Grafana allows exactly one default datasource; provisioning fails at startup every restart. Fix:
--set grafana.sidecar.datasources.defaultDatasourceEnabled=falsewhen installing loki-stack. - A scrape target is down — Prometheus couldn't scrape it (visible failure is a pull-model benefit).
- It's a visualization layer: it connects to data sources (Prometheus, Loki) and queries them live.
helm uninstall kube-prometheus-stack -n observability→helm uninstall loki-stack -n observability→kubectl delete namespace observability.- 13639 (Kubernetes Logs) and 12611 (Log volume), imported via the Grafana UI.
- Without it, the forward binds to loopback inside WSL only, and the Windows browser gets connection refused;
0.0.0.0binds all host interfaces.