Skip to content
streamprobe

Kubernetes operator · Go · MIT

Is your live stream actually live?

Declare a stream as a StreamProbe. The operator checks, on an interval, that the playlist answers, that its live edge moves, and that the origin serves the newest segment, and writes the answer where your platform already looks: the resource's status, Kubernetes events, and Prometheus.

At a glance

$ kubectl get streamprobes
NAME                READY   REASON          EDGE        ADVANCED   AGE
unified-live-demo   True    Live            935119251   2s         3h
channel-2           False   Stale           918233      6m         3h
origin-eu           False   SegmentFailed   4410291     1s         3h

Why an HTTP health check is not enough

A live stream fails in ways a 200 does not show. The origin answers, the playlist is valid, and nobody is watching anything.

The verdict

Each check sets the Ready condition. The reasons are tried in this order; the first that applies wins.

ReasonReadyWhen
FetchFailedFalsethe playlist could not be fetched or read, or lists no segment
EndedFalsethe playlist has #EXT-X-ENDLIST
StaleFalsethe live edge has not moved for longer than staleAfter (default: three target durations)
SegmentFailedFalsethe live-edge segment did not answer 2xx
LiveTrueotherwise

An event is recorded when the reason changes, not on every check, and five Prometheus metrics per stream follow it: see the reference.

Get started

You need Go 1.26 or later, kubectl, and a cluster: kind on your laptop is enough.

git clone https://github.com/Allan-Nava/streamprobe-operator
cd streamprobe-operator
make install     # the CRD, into the cluster of your current context
make run         # the controller, on your machine, against that cluster

In a second terminal, watch a public live demo stream:

kubectl apply -f - <<'EOF'
apiVersion: streaming.allan-nava.github.io/v1alpha1
kind: StreamProbe
metadata:
  name: unified-live-demo
spec:
  url: https://demo.unified-streaming.com/k8s/live/stable/live.isml/.m3u8
  interval: 30s
EOF
kubectl get sp -w

Then kubectl describe sp unified-live-demo shows the status and the events. To run it in the cluster instead, make deploy installs the published image, ghcr.io/allan-nava/streamprobe-operator (linux/amd64 and linux/arm64); the reference has the details. A Helm chart is planned (v0.2.0).

Built to learn Kubernetes from the inside

streamprobe is also a learning project: an operator written from scratch with kubebuilder and controller-runtime, by someone who ran live video on Nomad for years. How it works explains every piece, what an operator is, the reconcile loop, why the controller ignores its own writes, how it is tested against a real API server, and how each idea maps to Nomad.