Block 5 — Cluster Observability¶
Duration: 45 min
Goal: See what's running on the edge and cloud Kubernetes clusters and whether
the data services (RisingWave, TimescaleDB, Redpanda) are healthy — using
kube-prometheus-stack (Prometheus + Grafana) and k9s.
Why this block¶
Up to now you've checked health service-by-service — kubectl logs, a psql
query, the Redpanda Console. That works for one pod but doesn't answer "is the
whole cluster healthy, and what changed?" This block adds two complementary
tools:
k9s— a terminal UI for what's deployed: browse pods, deployments, events, and logs across every namespace at a glance. Zero cluster footprint (it's a local binary that talks to the API server).kube-prometheus-stack— Prometheus scrapes metrics; Grafana charts them. This is the is-it-healthy-over-time layer: node CPU/memory, pod restarts, RisingWave barrier latency (streaming freshness), TimescaleDB connections, Redpanda throughput.
The two clusters differ in how the stack gets installed, so each has its own section below.
Node sizing
The edge K3s nodes are t3.xlarge (4 vCPU / 16 GiB) specifically so a node can run the data stack and a trimmed monitoring stack. On the shared EKS cluster there's ample headroom, so the cloud install keeps Alertmanager and persistent storage; the edge install drops both.
Part A — Edge cluster (K3s)¶
Prerequisites — reconnect to the edge cluster¶
Same SSM tunnel as Block 3 / Block 4 — reopen it if you're in a fresh terminal:
mkdir -p ~/.kube
aws ssm get-parameter \
--name /workshop/ws-slot00/kubeconfig \
--with-decryption \
--query Parameter.Value \
--output text > ~/.kube/edge-config
export KUBECONFIG=~/.kube/edge-config
K3S_SERVER_ID=$(aws iot list-things-in-thing-group \
--thing-group-name ws-slot00-devices \
--query "things" --output text | tr '\t' '\n' | sort | head -1)
aws ssm start-session \
--target "$K3S_SERVER_ID" \
--document-name AWS-StartPortForwardingSession \
--parameters '{"portNumber":["6443"],"localPortNumber":["6443"]}' \
> /tmp/k3s-ssm-pf.log 2>&1 &
SSM_PF_PID=$!
sleep 8
sed -i.bak -E 's#server: https://[0-9.]+:6443#server: https://127.0.0.1:6443#' \
~/.kube/edge-config
kubectl get nodes
# When finished with the edge cluster: kill "$SSM_PF_PID"
Step 1 — Install kube-prometheus-stack (trimmed)¶
The edge install uses helm/monitoring-values-edge.yaml, which drops
Alertmanager and persistence and keeps a short 24h Prometheus retention so the
observability release never starves the workloads it watches.
View source — edge monitoring override values
#
# Installed as a standalone release in the `monitoring` namespace, NOT as an
# edge-stack subchart — same pattern the workshop uses for cert-manager and the
# CNPG / RisingWave operators (cluster infra installed once, out-of-band of the
# data umbrella chart). The prometheus-operator this bundles then auto-discovers
# the ServiceMonitor / PodMonitor resources emitted by the edge-stack chart.
#
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
# helm upgrade --install monitoring prometheus-community/kube-prometheus-stack \
# --namespace monitoring --create-namespace \
# -f helm/monitoring-values-edge.yaml
#
# TRIMMED for the edge: this cluster is 3× t3.xlarge and already runs the whole
# data stack. We drop Alertmanager, drop persistence, and keep Prometheus
# retention short so the observability release never starves the workloads it
# is meant to watch.
# ──────────────────────────────────────────────────────────────────────────────
# Let Prometheus discover ServiceMonitors/PodMonitors in ALL namespaces (the
# edge data stack lives in `edge`, not `monitoring`) rather than only those it
# "owns". Without this the operator ignores every monitor we emit.
prometheus:
prometheusSpec:
serviceMonitorSelectorNilUsesHelmValues: false
podMonitorSelectorNilUsesHelmValues: false
ruleSelectorNilUsesHelmValues: false
# Short local retention — this is a live demo cluster, not long-term storage.
retention: 24h
# No PVC: Prometheus TSDB lives on the node's emptyDir. A pod restart loses
# history, which is fine for a workshop and saves a 20Gi+ PV on a busy node.
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
cpu: "1"
memory: 1500Mi
# Alertmanager off — nobody is on-call for a workshop cluster, and it is the
# single biggest thing we can drop to reclaim memory on the edge.
alertmanager:
enabled: false
grafana:
enabled: true
# No admin ingress — reached via `kubectl port-forward` like the HMI / cloud
# dashboard (see Session 5 Block 5). Default admin password is set here for
# the workshop; rotate for any non-demo use.
adminPassword: workshop
persistence:
enabled: false
service:
type: NodePort
nodePort: 30902
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 300m
memory: 256Mi
# Auto-load any ConfigMap labelled grafana_dashboard: "1" — this is how the
# RisingWave / CNPG / Redpanda dashboards shipped by the edge-stack chart
# (helm/edge-stack/templates/monitoring/*-dashboard.yaml) land in Grafana.
sidecar:
dashboards:
enabled: true
label: grafana_dashboard
searchNamespace: ALL
datasources:
enabled: true
# node-exporter + kube-state-metrics stay ON — they are the "is the cluster
# healthy" backbone (node CPU/mem/disk, pod restarts, pending pods) and are
# cheap. Trim their requests for the small edge nodes.
nodeExporter:
enabled: true
prometheus-node-exporter:
resources:
requests:
cpu: 20m
memory: 32Mi
limits:
cpu: 100m
memory: 64Mi
kubeStateMetrics:
enabled: true
kube-state-metrics:
resources:
requests:
cpu: 20m
memory: 48Mi
limits:
cpu: 100m
memory: 128Mi
prometheusOperator:
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi
# K3s runs its control-plane as a single embedded process, so the separate
# etcd / scheduler / controller-manager / kube-proxy scrape targets that
# kube-prometheus-stack expects on a kubeadm cluster don't exist. Disabling
# them avoids a wall of red "target down" panels that would confuse attendees.
kubeControllerManager:
enabled: false
kubeScheduler:
enabled: false
kubeEtcd:
enabled: false
kubeProxy:
enabled: false
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update prometheus-community
helm upgrade --install monitoring prometheus-community/kube-prometheus-stack \
--namespace monitoring --create-namespace \
-f helm/monitoring-values-edge.yaml \
--wait --timeout 10m
This brings up Prometheus, Grafana, node-exporter, kube-state-metrics — and
the monitoring.coreos.com CRDs (PodMonitor / ServiceMonitor) that the next
step depends on.
Step 2 — Enable the edge-stack monitors¶
The edge-stack chart ships PodMonitors/ServiceMonitors for RisingWave,
TimescaleDB, and Redpanda plus a curated Grafana dashboard, but they're
off by default — the chart is installed (Block 3) before the CRDs exist,
and rendering a monitor with no CRD present fails the install. Now that Step 1
installed the CRDs, re-run the release with monitoring turned on:
View source — the monitoring toggle in edge-stack values
#
# DEFAULT OFF, and deliberately so: this chart is installed in Session 5 Block 3,
# BEFORE kube-prometheus-stack brings the monitoring.coreos.com CRDs (Block 5).
# Rendering a ServiceMonitor/PodMonitor with no CRD present fails `helm install`
# with "no matches for kind". Block 5 re-runs the release with:
# helm upgrade edge-stack ... --reuse-values --set monitoring.enabled=true
# once kube-prometheus-stack (and its CRDs + Grafana dashboard sidecar) are up.
monitoring:
enabled: false
# `release` label kube-prometheus-stack's operator matches on for rule/monitor
# discovery. Our values files set serviceMonitorSelectorNilUsesHelmValues=false
# so this is belt-and-suspenders, but keep it aligned with the release name
# (`monitoring`) used in Session 5 Block 5.
releaseLabel: monitoring
helm upgrade edge-stack ./helm/edge-stack \
--namespace edge --reuse-values \
--set monitoring.enabled=true
Confirm the monitors were created:
Step 3 — Open Grafana¶
No ingress — reach Grafana over an in-cluster port-forward (through the same SSM tunnel), matching how you reach the HMI and Redpanda Console:
kubectl port-forward -n monitoring svc/monitoring-grafana 3001:80 \
> /tmp/grafana-edge-pf.log 2>&1 &
GRAFANA_PF_PID=$!
until grep -q "Forwarding from" /tmp/grafana-edge-pf.log 2>/dev/null; do sleep 1; done
curl -sf -o /dev/null -w "%{http_code}\n" http://localhost:3001/login
kill "$GRAFANA_PF_PID" 2>/dev/null || true
Open http://localhost:3001 in a browser (keep the port-forward running).
Log in with user admin, password workshop, then:
- Dashboards → Edge Data Stack — Health — the curated board: pod readiness, restarts, per-pod CPU/memory, RisingWave barrier latency, TimescaleDB backends.
- Dashboards → Kubernetes / Compute Resources / Namespace (Pods) — one of the stock kube-prometheus-stack boards for whole-cluster resource usage.
Rotate the password for anything but a demo
adminPassword: workshop is set in the values file for workshop convenience.
For any non-throwaway cluster, remove it and let the chart generate a secret.
Part B — Cloud cluster (shared EKS)¶
On the shared EKS cluster there is one Prometheus + Grafana for everyone,
installed cluster-scoped by scripts/deploy-cloud-analytics.sh --shared (alongside
cert-manager and the operators) — so if the facilitator already deployed the
shared cloud-analytics release, it's already running. cloud-analytics is
now one shared release for every slot (#253), not one per slot, and it emits
one set of PodMonitors in the cloud-analytics namespace — every slot's
RisingWave/TimescaleDB telemetry flows through those same monitors, filtered
by deployment_id rather than by namespace.
View source — cluster-scoped monitoring install in the deploy script
#
# ONE Prometheus + Grafana for the whole shared workshop-eks cluster, installed
# cluster-scoped by scripts/deploy-cloud-analytics.sh (alongside cert-manager /
# risingwave-operator / cnpg). It discovers the per-slot PodMonitors that each
# cloud-analytics release emits in its own namespace, so every slot's RisingWave
# + TimescaleDB show up in the same Grafana with a namespace filter.
#
# helm upgrade --install monitoring prometheus-community/kube-prometheus-stack \
# --namespace monitoring --create-namespace \
# -f helm/monitoring-values-cloud.yaml
#
# The EKS cluster has real headroom (managed node group), so unlike the edge
# override we keep Alertmanager and give Prometheus a persistent volume + longer
# retention.
# ──────────────────────────────────────────────────────────────────────────────
prometheus:
prometheusSpec:
# Discover monitors in every slot namespace, not just `monitoring`.
serviceMonitorSelectorNilUsesHelmValues: false
podMonitorSelectorNilUsesHelmValues: false
ruleSelectorNilUsesHelmValues: false
retention: 7d
storageSpec:
volumeClaimTemplate:
spec:
storageClassName: gp3
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 20Gi
resources:
requests:
cpu: 300m
memory: 1Gi
limits:
cpu: "1"
memory: 2Gi
alertmanager:
enabled: true
alertmanagerSpec:
storage:
volumeClaimTemplate:
spec:
storageClassName: gp3
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 2Gi
grafana:
enabled: true
adminPassword: workshop
persistence:
enabled: true
storageClassName: gp3
size: 2Gi
# Reached via `kubectl port-forward svc/monitoring-grafana -n monitoring 3002:80`
# — no ingress/LoadBalancer, matching the cloud dashboard access pattern (#159).
service:
type: ClusterIP
sidecar:
dashboards:
enabled: true
label: grafana_dashboard
searchNamespace: ALL
datasources:
enabled: true
nodeExporter:
enabled: true
kubeStateMetrics:
enabled: true
# EKS is a managed control plane: the API server is scrapable but etcd /
# scheduler / controller-manager are AWS-managed and not exposed to workloads,
# so disable those targets to avoid permanently-down panels.
kubeControllerManager:
enabled: false
kubeScheduler:
enabled: false
kubeEtcd:
enabled: false
kubeProxy:
enabled: false
Step 1 — Point kubectl at the shared cluster¶
If the monitoring namespace is empty, the cluster-scoped install hasn't run —
re-run scripts/deploy-cloud-analytics.sh --shared (without
--skip-cluster-scoped), or install it by hand with
helm/monitoring-values-cloud.yaml.
Step 2 — Confirm the shared release's monitors exist¶
You should see the RisingWave PodMonitor and the CNPG-managed TimescaleDB
PodMonitor for the shared cloud-analytics namespace — every slot's data
flows through these same two monitors (#253).
Step 3 — Open Grafana¶
kubectl port-forward -n monitoring svc/monitoring-grafana 3002:80 \
> /tmp/grafana-cloud-pf.log 2>&1 &
GRAFANA_PF_PID=$!
until grep -q "Forwarding from" /tmp/grafana-cloud-pf.log 2>/dev/null; do sleep 1; done
curl -sf -o /dev/null -w "%{http_code}\n" http://localhost:3002/login
kill "$GRAFANA_PF_PID" 2>/dev/null || true
Open http://localhost:3002 (admin / workshop) and find Cloud
Analytics — Health (cloud-analytics) — pod/container-level health (restarts,
CPU, memory, RisingWave barrier latency, CNPG connections) for the one shared
release. This is cluster-level metrics, not deployment_id-scoped (#253), so
it reflects every slot's traffic together — the namespace dropdown at the
top still exists but has nothing else to switch to now that there's only the
one shared release.
k9s — browsing what's deployed¶
Grafana answers is it healthy; k9s answers what's running, right now far
faster than repeated kubectl get. Install it locally (it uses your current
KUBECONFIG, so it works against whichever cluster your tunnel/context points
at):
# macOS
brew install derailed/k9s/k9s
# or download a release binary: https://github.com/derailed/k9s/releases
k9s version
Launch it against the edge cluster (tunnel open) or the cloud cluster:
Useful moves once inside:
:then a resource name —:pods,:deployments,:events,:podmonitors.0— show all namespaces; type to filter.- Select a pod and press
lfor logs,dto describe,sfor a shell. :xray deployments— a tree of a deployment down to its pods and containers.
Wrap-Up¶
You now have both a what's-deployed view (k9s) and a health-over-time view
(Grafana) for each cluster:
Edge K3s → kube-prometheus-stack (trimmed) → Grafana "Edge Data Stack — Health"
Shared EKS → kube-prometheus-stack (shared) → Grafana "Cloud Analytics — Health" (one shared release, #253)
Both → k9s (local binary, current kubeconfig)
The RisingWave barrier-latency panel is the one to watch during Session 6's network-failure simulation — it's the streaming-freshness signal that spikes when compute stalls, the same story the data-freshness panel tells from the application side.