Skip to main content
Welcome to the Saturation Panels lab. In this lesson you’ll add saturation (state timeline) panels to an existing Grafana dashboard so you can quickly see historical CPU and memory usage patterns per pod. What you’ll do:
  • Deploy the starter dashboard ConfigMap so Grafana has a base dashboard to edit
  • Configure traffic to produce realistic load
  • Build state timeline panels that bucket CPU and memory usage into low/medium/high states per pod
  • Interpret state timeline patterns to surface operational insights
Prerequisites
  • A running Kubernetes cluster with Prometheus metrics and Grafana configured
  • The starter dashboard YAML available at ~/monitoring/starter-dashboard.yaml
Deploy the starter dashboard ConfigMap:
Open the order processing UI and set the traffic generator to medium traffic, moderate processing, and an error rate around 1%. Keep the generator running while you add panels so you have live data to evaluate. Once Grafana is ready, go to Dashboards → Order Processing. You should see a saturation row with four existing panels: Container Memory Usage, CPU Usage, Memory Usage Rate, and CPU Throttling Rate.
A Grafana dashboard UI with a left navigation menu. The main view shows panels with container memory and CPU usage graphs and metrics for order-frontend and order-backend services.
Identifying saturation-panel use cases Saturation panels are most useful when you need to understand historical resource pressure at a glance. For example:
  • SREs investigating crash loops or pod restarts during traffic spikes will benefit from pod-level restart count and resource saturation timelines.
  • Executives or product managers reviewing long-term trends typically need higher-level metrics (cost, overall capacity); saturation panels are most valuable only when drill-down to pod-level behavior matters.
Choosing a visualization for historical patterns Time-series charts show values over time but can be noisy when scanning many pods. A state timeline visualization aggregates each pod’s metric into discrete states (e.g., low/medium/high) and shows those states across time, making it faster to see when pods were stressed. Suggested threshold buckets:
  • low: under 30% (ok)
  • medium: 30–60% (warning)
  • high: 60%+ (critical)
You can adjust thresholds to match your SLOs or operational runbooks. Building state timeline panels for CPU utilization Goal: display each pod’s CPU utilization as a percentage of its CPU limit. Key PromQL requirements:
  • Compute per-pod CPU usage rate
  • Divide by per-pod CPU limits
  • Multiply by 100 to convert to percent
  • Group by pod so each pod is a separate timeline row
Example PromQL for the order-frontend pods (set visualization unit to percent and thresholds to 50 and 80):
If some pods do not define CPU or memory limits, the kube_pod_container_resource_limits denominator can be zero, yielding NaN or no data for that pod. To avoid division-by-zero, wrap the denominator with clamp_min(..., 1e-9):
This preserves the percentage intent while preventing division errors.
Grafana steps for CPU state timeline
  • Edit the dashboard and add a new panel (or duplicate an existing saturation panel).
  • Change the visualization type to “State timeline”.
  • Switch the query editor to PromQL and paste the PromQL above.
  • Set the unit to “percent (0-100)” and configure thresholds (example: 50, 80).
  • Save the panel (Dashboard → Save or Dashboard → Settings → JSON Model → Save changes).
To create a backend CPU timeline, duplicate the frontend CPU panel and replace the pod regex with pod=~"order-backend-.*":
A Grafana monitoring dashboard showing time-series charts, legends, and panels for order-processing metrics. The dark UI includes graphs for frontend pod CPU utilization and a left navigation sidebar.
Building state timeline panels for memory utilization Memory is similar to CPU but uses the working set (resident memory) divided by the pod’s memory limit. Example PromQL for order-frontend memory utilization (percent of memory limit):
Grafana steps for memory state timeline
  • Create a new panel or duplicate the frontend CPU state timeline.
  • Replace the query with the memory PromQL above.
  • Set visualization to “State timeline”, unit to “percent (0-100)”, and thresholds (example: 60, 85).
  • Save the panel.
For backend memory, duplicate and change the regex to pod=~"order-backend-.*":
After saving the dashboard JSON model, you should have CPU and memory state timeline panels for both frontend and backend pods in the Golden Signals / Saturation row.
A Grafana dashboard screenshot showing monitoring panels for order processing with widgets for frontend and backend pod CPU and memory utilization, each displaying green percentage boxes (e.g., "<50%", "<60%"). The left sidebar with navigation (Home, Dashboards, Explore, etc.) and top toolbar are also visible.
Interpreting state timeline patterns Use state timelines to quickly diagnose whether a change was transient, systemic, or pod-specific. Example pattern and likely interpretation:
  • 09:00–12:00 — all pods green (below threshold)
  • 12:00–13:00 — all pods yellow (moderate pressure)
  • 13:00–14:00 — one pod red, others yellow (one pod overloaded)
  • 14:00 onward — all pods return to green
Most likely explanation: a short-lived traffic spike (e.g., lunch traffic) caused system-wide pressure; one pod became red due to uneven load or pod-level issues. This pattern suggests transient load, not a memory leak or long-term degradation. If autoscaling is not enabled, spikes will likely appear as synchronized yellow across pods; a single red pod points to uneven traffic distribution or specific contention. Threshold mapping (example) Best practices and tips
  • Use thresholds that align with your operational playbooks and SLOs.
  • Ensure pods define resource requests and limits; otherwise, percentages may be missing or invalid.
  • When using PromQL aggregations with denominators, guard against division-by-zero with clamp_min(...).
  • Keep the state timeline rows to a manageable number of pods (or use templating/variables) to avoid overcrowding.
State timeline panels are ideal for audiences who need fast visual answers about historical resource states (SREs, on-call engineers, operations leads). Use clear, actionable thresholds and document what each color/state means in your runbooks.
References and further reading That completes this lab — thank you.

Watch Video