123DevOps··8 min read

Monitoring, logging, and runtime security on Kubernetes: metrics, node-level collection, Falco, and Tetragon

A practical guide to the three visibility layers of a cluster: metrics with metrics-server and kube-prometheus-stack, node-level log collection with Grafana Alloy or Fluent Bit, and runtime detection with Falco and Tetragon.

Kubernetes

A cluster without visibility only tells you something is wrong when a user complains. And visibility here has three different layers, with different tools: metrics tell you how much (latency, errors, CPU usage), logs tell you what (the error message, the request), and runtime security tells you who did something they shouldn’t have (a shell opened in a production container, a new binary executed). This guide sets up all three, using what could be validated on a kind cluster running Kubernetes v1.37.0.

To avoid repeating content: the detailed Prometheus configuration is in configuring Prometheus, the logging stack in LGTM: Loki, Grafana, Tempo, and Mimir, and OpenTelemetry in OpenTelemetry: where to start. The focus here is how these pieces fit into a Kubernetes cluster and what to alert on.

Metrics: two different systems

metrics-server and kubectl top

metrics-server collects CPU and memory from the kubelets and serves the metrics.k8s.io API, whose definition became stable in Kubernetes 1.37. It exists for kubectl top and the HorizontalPodAutoscaler, not for history or alerting. In the lab, which has no metrics-server, the result is blunt:

$ kubectl top nodes
error: Metrics API not available

# installation (v0.9.1 in the research notes; check the current version)
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml

kube-prometheus-stack

For history, dashboards, and alerts, the most common path is the kube-prometheus-stack chart, which bundles the Prometheus Operator, Prometheus, Alertmanager, Grafana, node-exporter, and kube-state-metrics. I didn’t install it on the shared cluster, but I rendered the chart to see what it ships:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm template kps prometheus-community/kube-prometheus-stack -n monitoring --include-crds > kps.yaml
grep -c "^kind: PrometheusRule" kps.yaml    # 35 in chart 93.10.1
grep -c "^kind: ServiceMonitor" kps.yaml    # 13

In other words, the chart already comes with dozens of rule groups (such as KubePodCrashLooping, KubeNodeNotReady, NodeFilesystemSpaceFillingUp, KubePersistentVolumeFillingUp, and CPUThrottlingHigh) and a Watchdog alert that fires all the time on purpose, so you know the alerting pipeline is alive. One detail that confuses people: the generated Prometheus resource only loads PrometheusRule objects with the release: <release-name> label (in the render, release: "kps"). A rule without that label is silently ignored.

Golden signals and what to alert on

The default rules cover cluster health. For your applications, use the four golden signals:

Signal Question Example metric
Latency how long does it take? p99 of http_request_duration_seconds
Traffic how much is coming in? rate of http_requests_total
Errors how much is failing? share of 5xx responses
Saturation how full is it? CPU throttling, memory near the limit, queue depth

Alert on symptoms users feel (errors and latency), not on causes (CPU at 80%). Causes belong on dashboards. Every critical alert should wake someone up and have a clear action; if the usual response is “ignore it,” downgrade it to warning or delete the rule. Use for: so short spikes of a few seconds don’t fire, and route by team and severity in Alertmanager. Here is a rule with the two most important conditions, validated against the chart’s PrometheusRule CRD schema (metric names depend on your instrumentation):

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: api-golden-signals
  namespace: monitoring
  labels:
    release: kps            # must match the chart's ruleSelector
spec:
  groups:
    - name: api.golden-signals
      rules:
        - alert: ApiHighErrorRate
          expr: |
            sum(rate(http_requests_total{job="api", code=~"5.."}[5m]))
              / sum(rate(http_requests_total{job="api"}[5m])) > 0.05
          for: 10m
          labels:
            severity: critical
          annotations:
            summary: "More than 5% of API requests failing with 5xx"
        - alert: ApiHighP99Latency
          expr: |
            histogram_quantile(0.99,
              sum by (le) (rate(http_request_duration_seconds_bucket{job="api"}[5m]))) > 1
          for: 15m
          labels:
            severity: warning
          annotations:
            summary: "API p99 above 1s"

Logs: node-level collection

In Kubernetes, the application writes to stdout/stderr and the runtime stores that in files on the node. I checked on the kind worker:

$ docker exec blog-lab-worker sh -c 'tail -n 1 /var/log/pods/f-audit_web_*/web/0.log'
2026-11-25T04:39:58.66320718Z stdout F ::1 - - [25/Nov/2026:04:39:58 +0000] "GET / HTTP/1.1" 200 896 "-" "Wget" "-"

The path is /var/log/pods/<namespace>_<pod>_<uid>/<container>/<n>.log, and /var/log/containers/ holds symlinks with names that are easier to match. Each line has a timestamp, the stream (stdout/stderr), a flag (F for a full line, P for a partial one), and the message. kubectl logs reads these files; when the pod is deleted or the node goes away, they go with it. That’s why the standard pattern is a DaemonSet collector, one per node, reading that directory and shipping to a backend.

Collector Status Notes
Promtail deprecated replaced by Grafana Alloy; commercial support ended on Feb 28, 2026, and the code was removed as of Loki 3.7.3
Grafana Alloy active (v1.22.0) collects logs, metrics, and traces; Promtail’s successor
Fluent Bit active lightweight, written in C; widely used as a DaemonSet
Fluentd active heavier, large plugin ecosystem; see what is Fluentd

If you still run Promtail, migrating to Alloy is no longer optional. The official Alloy chart runs as a DaemonSet and mounts the node’s /var/log with a single value; I rendered chart 1.16.0 and applied it with --dry-run=server:

helm repo add grafana https://grafana.github.io/helm-charts
helm upgrade --install alloy grafana/alloy -n monitoring --create-namespace \
  --set alloy.mounts.varlog=true \
  --set-file alloy.configMap.content=config.alloy

The config.alloy file discovers the pods, builds the file paths, and ships to Loki (v3.7.10 is the current stable release in the notes). The syntax changes between versions, so use the migration example from the Alloy docs. For queries, see querying logs with LogQL.

If you have already standardized on OpenTelemetry, the OpenTelemetry Collector (v0.166.0) can play this role too, with the filelog receiver in a DaemonSet, unifying logs, metrics, and traces in a single layer.

Runtime security: detecting what happens inside the container

Metrics and logs show what the application says. Runtime security watches what the kernel sees: processes started, files opened, network connections. That’s how you find out about a kubectl exec in production or a crypto miner that came in through a dependency.

Falco

Falco (0.45.2, a CNCF graduated project) captures syscalls via eBPF and matches them against rules. The default ruleset, distributed as the falco-rules artifact through falcoctl, already detects classic cases such as Terminal shell in container (a shell with a TTY opened in a container, exactly what kubectl exec -it ... sh produces) and reads of sensitive files like /etc/shadow. You add your own rules through the chart’s customRules value:

driver:
  kind: modern_ebpf
falco:
  json_output: true
customRules:
  production-rules.yaml: |-
    - rule: Shell in production container
      desc: A shell was started inside a container in the production namespace
      condition: >
        spawned_process and container
        and proc.name in (bash, sh, zsh, ash, dash)
        and k8s.ns.name = "production"
      output: >
        Shell in production container (user=%user.name pod=%k8s.pod.name
        ns=%k8s.ns.name image=%container.image.repository cmd=%proc.cmdline
        parent=%proc.pname)
      priority: WARNING
      tags: [container, shell, mitre_execution]

spawned_process and container are macros from the default ruleset; condition filters the event, output defines the message using event fields, and priority sets the severity. I validated the chart (falco 9.2.2) with helm template -f and kubectl apply --dry-run=server, and the rule shows up in the generated ConfigMap. I did not run Falco (it needs privileged access to the node’s kernel), so the rule wasn’t checked by Falco’s own validator. Test it with falco --validate before using it.

helm repo add falcosecurity https://falcosecurity.github.io/charts
helm upgrade --install falco falcosecurity/falco -n falco --create-namespace -f falco-values.yaml

Alerts show up in the Falco pod’s logs (as JSON, with json_output). To send them to Slack, a SIEM, or a webhook, the chart includes Falcosidekick as an option (falcosidekick.enabled).

Tetragon

Tetragon (v1.8.0), a Cilium sub-project, also uses eBPF, but goes beyond detection: with TracingPolicy policies it can block the action in the kernel, for example by killing the process that tried to open a forbidden file. It works with any CNI, not just Cilium. In practice, Falco is more commonly used as a detector with a mature ruleset, and Tetragon comes in when you need enforcement. I didn’t validate Tetragon manifests in this lab; check the current docs for TracingPolicy examples.

Tools by layer

Layer Question Tools
Resource metrics how much is each pod using right now? metrics-server (kubectl top, HPA)
Metrics and alerts is the service healthy? kube-prometheus-stack, Prometheus, Alertmanager
Logs what did the application say? Alloy, Fluent Bit, or Fluentd + Loki
Traces and a single pipeline where did the request spend its time? OpenTelemetry Collector + Tempo
Runtime (detection) who did something they shouldn’t have? Falco
Runtime (enforcement) can we stop it in the kernel? Tetragon
Cluster API who changed what through the API? Kubernetes audit log

The last row is the subject of the next guide: audit logging for security on Kubernetes.

Checklist

  • metrics-server installed for kubectl top and HPA
  • kube-prometheus-stack with PrometheusRule objects carrying the right release label
  • Application alerts based on errors and latency, plus a monitored Watchdog
  • DaemonSet log collector, with Promtail replaced by Alloy
  • Falco with the default ruleset and validated custom rules
  • Runtime alerts sent to a channel someone actually watches

Metrics tell you something is wrong, logs tell you what, and runtime security tells you who: you need all three.

Get updates on new posts and stay in the loop!