How to Build Your Own Autonomous SRE
A free, open-source series that builds an autonomous SRE step by step. Episode 1 wires K8sGPT, Gemini and Slack into a kind cluster, diagnoses a real OOMKill in 30 seconds, and shows what state-driven detection misses.
Nati ShalomCo-founder & CTO
TL;DR
- A free, open-source training series that builds an autonomous SRE step by step, on a laptop, in public.
- Episode 1 stands up a kind cluster with Prometheus and Grafana, wires in K8sGPT (a CNCF Sandbox project) with Gemini 2.5 Flash and a Slack webhook, and triggers a real OOMKill. The diagnosis lands in Slack in about 30 seconds.
- It also shows the honest limit: a slow memory leak never changes pod state, so state-driven detection stays silent. Catching it needs metric-driven detection, which is Episode 2.
- The setup guide below gets the same loop running on your own cluster.
I gave myself one project: build the autonomous SRE platform I would actually want to use as an on-call engineer, do it entirely with open source, and prove it works in 30 minutes on a laptop. Not a vendor demo. Not a benchmark. A real Kubernetes cluster, a real container running out of memory, a real Slack channel, and an AI agent doing the diagnosis I used to wake up at 3 a.m. to do myself.
If your reaction to "AI is doing SRE work" sits somewhere between healthy skepticism and quiet curiosity, this series is for you.
The five-episode arc
- The OOMKill anchor (this episode): autonomous diagnosis, and its honest limit.
- Closing the detection gap: extending K8sGPT with metric-driven detection that catches the slow leak.
- GitOps remediation: wiring detection into Argo CD so the agent opens pull requests instead of asking for shell access.
- Guardrails and human-in-the-loop: the trust gradient between "the agent acts" and "the agent asks first."
- LLM swap: moving from the default Gemini to a self-hosted or private model.
Why build this now
The on-call gap has been widening for a decade. Three things are happening at once.
Incident volume is up. Kubernetes multiplies your surface area. Every microservice is another thing that can crash, leak memory, get OOMKilled, mis-route or fail a probe. The number of things that can wake you up has grown faster than your team.
On-call headcount is flat. Senior on-call engineers are scarce, the SRE hiring market is brutal, and burnout is the attrition driver almost nobody puts in a post-mortem.
LLMs got good enough to do the boring 70% of diagnosis. Reading kubectl output, correlating with metrics and proposing a fix are table stakes for any frontier-class model in 2026. That was not true in 2023.
If your platform team is still getting paged for OOMKills in 2026, the tooling to stop it is here, it is free, it is in the CNCF Sandbox, and it runs on a laptop. The hard part is no longer the AI. It is how much you trust it.
So here is what trusting it looks like.
What Episode 1 does, live, in 30 minutes
One continuous take with a 30:00 countdown on screen. No cuts, no edited demos. Watch the full recording. Six beats:
- Stand up a demo cluster. kind, Prometheus, Grafana, three sample apps and a load generator. About 5 minutes.
- Wire up the agent. K8sGPT for detection, Gemini 2.5 Flash for diagnosis, a Slack webhook for delivery. About 40 lines of YAML.
- Trigger a real OOMKill. Push a running pod past its 128Mi memory limit until the Linux kernel kills it. No
kubectl delete, no mocking. - Watch the AI diagnose it. A Slack message lands in the demo channel in under a minute with the cause, the fix and how to prevent the next one.
- Trigger a slow memory leak. This is the honest part: what the agent does not catch today.
- What it means and what comes next. Different detection paradigms catch different things. The right answer is to run more than one.
The stack: three pieces
All open source, all running locally.
- A kind cluster on the laptop. Three nodes, Prometheus and Grafana for the dashboard, three sample apps (payments-api, recommend-svc, catalog-svc) instrumented for the four golden signals (latency, traffic, errors, saturation), and a small load generator.
- K8sGPT. The agent. A CNCF Sandbox project that runs inside the cluster as a Kubernetes operator.
- Gemini 2.5 Flash. The LLM that does the diagnosis, on the free tier with a Google AI Studio key. It could as easily be Claude, OpenAI or an Ollama model on your laptop: K8sGPT is pluggable at the LLM layer.
Output goes to a Slack channel through a webhook. No third-party SaaS in the loop.
If you expected "the agent" to be exotic and proprietary, it is not. The interesting part is the architecture.
What K8sGPT is, and why start here
K8sGPT is an open-source agent (Apache 2.0) that scans your Kubernetes cluster, detects failures, asks an LLM to diagnose them, and writes the answer back as a standard Kubernetes object. Alex Jones and Thomas Schuetz started it in 2023, and it is now a CNCF Sandbox project.
Three reasons it is the starting point for this series:
- It is Kubernetes-native. No sidecars, no shadow data plane, no separate observability backend. It reads from the Kubernetes API, writes back to the Kubernetes API, and is configured through a Custom Resource. Same mental model as everything else on your cluster.
- It is pluggable where it matters. The LLM backend is configurable (Gemini, OpenAI, Anthropic Claude, Ollama, Bedrock, Vertex, Azure OpenAI, Cohere, watsonx, LocalAI). So are the output sinks (Slack, Mattermost, Microsoft Teams, webhook, file). Analyzers can be extended through a gRPC plugin protocol.
- It is scope-bounded. K8sGPT does detection and diagnosis. It does not try to be a full SRE platform, and it does not take action on your cluster: its
autoRemediationflag is off by default and stays off for this series.
There are credible alternatives. Robusta's HolmesGPT is the closest neighbor, and a later episode covers the differences. K8sGPT is the simplest path from nothing to autonomous diagnosis in your Slack channel.
How K8sGPT works
Five components, all running in your cluster:
- A K8sGPT Custom Resource. A YAML object you apply with kubectl. It tells the operator which analyzers to enable, which LLM backend to call and which sink to send results to. About forty lines, including the two Secrets that hold the Gemini API key and the Slack webhook URL.
- The K8sGPT operator. A Kubernetes controller that watches the CR and runs a scan loop on a schedule, roughly every ten seconds on a laptop.
- Analyzers. Eleven-plus built in (Pod, Service, Deployment, PVC, Ingress, HPA, Node, NetworkPolicy, CronJob, PDB, webhook configurations and more). Each watches a class of Kubernetes state. When a pod enters CrashLoopBackOff, the Pod analyzer notices. When a PVC fails to mount, the PVC analyzer notices.
- An AI client. Calls the LLM you configured with the fault context (container exit codes, pod events, container statuses) as a structured prompt, and gets back a plain-English explanation with remediation steps.
- Sinks. Send the formatted result wherever you said. Here, Slack.
Each scan's output lands as a standard Result Custom Resource (core.k8sgpt.ai/v1alpha1.Result). That detail matters: any tool that reads K8sGPT Results today will read whatever your custom analyzers emit tomorrow, because the format is the same. The contract is the CRD.
What the demo looks like
The diagnosis beat. From a terminal:
./scripts/trigger-oomkill.sh
That calls the /allocate?mb=200 endpoint on the payments-api pod until the container exceeds its 128Mi memory limit. The kernel does the OOMKill, the kubelet restarts the container in place, and the cycle repeats. Within seconds the dashboard reacts: composite health drops to 0, CrashLoopBackOff appears in the active-fault-states table, and the service-errors panel climbs (because Prometheus cannot scrape a pod that is not there). About thirty seconds later, K8sGPT's diagnosis lands in Slack:
Error: Container payments-api was OOMKilled (exit code 137) after exceeding its 128Mi memory limit. The container has restarted several times in the last few minutes, indicating a sustained problem rather than a transient spike.
Solution: 1. Increase the container's memory limit (and matching request) in the Deployment spec; start with 384Mi for ~3× headroom. 2. Verify the load profile is realistic; if the new ceiling is exceeded again, investigate a memory leak or unbounded allocation. 3. Add a Prometheus alert on sustained RSS growth so you catch the next one before the kill.
A junior-SRE post-mortem, delivered to the right channel in 30 seconds, with no human on the keyboard.
The honest beat. Next, a slow memory leak on a different pod, recommend-svc. The leak is fast enough to see on the saturation panel, memory climbing minute by minute, but slow enough that the kernel has not OOMKilled the container yet.
The dashboard says everything is fine. Composite health is 100, there is no CrashLoopBackOff, and all apps show as ready, yet recommend-svc's saturation is climbing by about 20 MB per minute. The composite health score eventually reflects it, because saturation is one of its inputs. The active-fault-states table does not, because the pod is still Running. K8sGPT posts nothing.
Why? K8sGPT's default analyzers are state-driven: they react to Kubernetes state such as CrashLoopBackOff or ImagePullBackOff. A pod whose RSS is climbing is still Running, so the Pod analyzer has nothing to report. No state change, no diagnosis.
That is not a K8sGPT bug. It is how state-driven detection works. Catching a slow leak takes metric-driven detection, watching numbers climb over time. Different paradigm, and the subject of Episode 2. (We cover the two detection classes in depth in Detect, Diagnose, Act, Verify: Inside the Closed Loop.)
I show this on camera because the most important thing in an autonomous SRE story is being honest about what the agent does not do. K8sGPT catches a meaningful share of real-world Kubernetes faults. It does not catch all of them. The right answer is more than one detection layer, and that is the arc of this series.
Setup guide: run K8sGPT yourself
Prerequisites
- Docker Desktop, or any local container runtime that kind supports
- kind 0.20 or later
- Helm 3
- kubectl
- A Gemini API key from Google AI Studio (the free tier is fine)
- A Slack workspace where you can create an incoming webhook
1. Create a cluster
kind create cluster --name demo
2. Install Prometheus and Grafana
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install prometheus-stack prometheus-community/kube-prometheus-stack \
--namespace monitoring --create-namespace
Port-forward Grafana when you need it (the default login is admin / prom-operator):
kubectl -n monitoring port-forward svc/prometheus-stack-grafana 3000:80
3. Create a Slack incoming webhook
Create a Slack app (api.slack.com/apps → Create New App → From scratch), add an incoming webhook for the channel that should receive alerts, and copy the URL.
kubectl create namespace k8sgpt-system
kubectl -n k8sgpt-system create secret generic k8sgpt-slack \
--from-literal=webhook-url='https://hooks.slack.com/services/...'
4. Store the Gemini API key
kubectl -n k8sgpt-system create secret generic k8sgpt-llm \
--from-literal=api-key='YOUR_GEMINI_API_KEY'
5. Install the K8sGPT operator
helm repo add k8sgpt https://charts.k8sgpt.ai/
helm install k8sgpt-operator k8sgpt/k8sgpt-operator \
--namespace k8sgpt-system
6. Apply the K8sGPT Custom Resource
Save your K8sGPT CR (backend, model, secret references and Slack sink) as k8sgpt-cr.yaml, then:
kubectl apply -f k8sgpt-cr.yaml
Wait about 30 seconds and confirm the operator is reconciling:
kubectl -n k8sgpt-system get pods
# k8sgpt-operator-controller-manager Running
# k8sgpt-sample Running
7. Trigger a fault
The fastest way to verify the loop: deploy a pod with a tiny memory limit and watch it OOMKill itself.
apiVersion: v1
kind: Pod
metadata:
name: oom-demo
namespace: default
spec:
containers:
- name: leaker
image: polinux/stress
resources:
limits:
memory: "32Mi"
command: ["stress"]
args: ["--vm", "1", "--vm-bytes", "128M", "--vm-hang", "1"]
kubectl apply -f oom-demo.yaml
Within a minute or two the pod enters CrashLoopBackOff and the K8sGPT diagnosis lands in your Slack channel.
If nothing arrives, start with kubectl -n k8sgpt-system logs deploy/k8sgpt-sample --tail=20. The most common failures are "AI provider not configured" (the secret name does not match the CR), "no quota" (the Gemini free-tier daily ceiling) and "webhook returned 4xx" (a malformed Slack URL).
What's next
Three questions shape the next episodes, and operator input matters more than mine:
- Which Kubernetes fault class do you wish the agent caught natively? Episode 2 extends K8sGPT's detection layer.
- What is the biggest blocker between "I see how this works" and "I would run this in my own cluster"? Episodes 3 and 4 take it on directly.
- Where would you draw the line on letting the agent act, not just diagnose? Episode 4 is about exactly that.
Ready to go beyond diagnosis?
DataAgent adds metric- and state-driven detection, verified remediation and guardrails you set, on your own Kubernetes and AWS environment.
- #K8sGPT
- #Autonomous SRE
- #Kubernetes
- #OOMKilled
- #Open Source
- #Training
See remediation-first in your own stack
Install an agent and watch DataAgent map your topology. No credentials, no commitment.
Keep reading
Engineering12 minWhy Your AI SRE Can’t Stop a Java Memory Leak Before the OOMKill
We ran five versions of a slow leak on our own Kubernetes cluster. An observability-first agent, ours on day one, warned zero minutes ahead and raised the limit. Here is what it took to fix the leak before the crash, and a ten-minute test for your own Java services.
Nati Shalom • Nov 27, 2026
Engineering6 minThe One-Click Tested Hotfix: Earning the Right to Execute
A verified fix still needs permission. Two stages sit between a checked change and a closed incident: gate it against the Trust Ladder, then execute and verify, with automatic rollback if verification fails.
Nati Shalom • Nov 27, 2026
Case Study6 minWhy Our AI SRE Failed 13 Times, and What Fixed It
A reply to the five-phase roadmap to autonomous SRE: start with the map of your system, not the pipe
Nati Shalom • Nov 24, 2026