Observability Lab, Part 2: I Broke My Kubernetes App on Purpose. Here's What Happened
Nandan Jadhav

In Part 1, I built a small Kubernetes lab using k3s on a single EC2 instance in my own AWS account, for about ₹500 a month.
An empty cluster doesn’t teach you much though. So in this part, I deployed a small food ordering app on it, written in Python with FastAPI, and then broke it on purpose, four different ways.
I wanted to see how the app behaves when things go wrong like when a pod dies, when a dependency starts failing, when it slows down, and when it disappears completely. And I wanted to see it before adding any metrics or dashboards, with nothing but a log of response codes to go on.
What does failure look like when that’s all you have?
What I built
The app is QuickBite again, the fictional food ordering service from my SLI, SLO and SLA post. This version is deliberately small with two services and a load generator that keeps sending orders.
When an order comes in, the order service asks the inventory service whether the item is in stock, then confirms the order. Both run as Kubernetes Deployments with two replicas each, behind Kubernetes Services.

| Component | What it does | Replicas |
|---|---|---|
inventory-service |
Returns stock for an item. Knows burger, pizza, biryani and dosa. | 2 |
order-service |
Accepts orders and asks inventory for stock before confirming. Gives up after 3 seconds. | 2 |
loadgen |
Sends one order a second, including “sushi”, which inventory doesn’t know, so there are always some 404s. |
1 |
Both services have failure switches built in: FAIL_RATE (share of requests that fail) and EXTRA_LATENCY_MS (added delay), set through environment variables.
The code and Kubernetes manifests are on GitHub.
Getting it running
Everything is in the repository, so I won’t go through every file. Three things are worth mentioning.
1. Building images for ARM. The lab runs on a Graviton (ARM) instance, so I built the images with Docker directly on it. Docker builds for the machine it runs on, so no extra flags were needed.
2. Docker and k3s don’t share images. k3s runs containers with containerd, which keeps its own image store. An image built with Docker isn’t visible to Kubernetes until you import it:
docker save order-service:0.1.0 | sudo k3s ctr images import -
I also used fixed version tags like 0.1.0 instead of latest. With latest, Kubernetes tries to pull the image from Docker Hub, can’t find it, and the pod fails with ErrImagePull.
3. Applying the manifests.
kubectl apply -f k8s/
kubectl -n shop get pods
NAME READY STATUS RESTARTS AGE
inventory-service-5b9df5fb7c-dbsbt 1/1 Running 3 (10d ago) 11d
inventory-service-5b9df5fb7c-rhrlg 1/1 Running 3 (10d ago) 11d
loadgen-6b847654cc-rf2nf 1/1 Running 0 22s
order-service-5854d44c69-j7k8c 1/1 Running 3 (10d ago) 11d
order-service-5854d44c69-xpp2m 1/1 Running 3 (10d ago) 11d
One detail in that output is easy to misread. Every app pod shows 3 restarts, yet nothing had crashed. It’s the nightly auto-stop from Part 1: each time the instance stops and starts again, Kubernetes counts a restart for every pod.
The whole app is small. Each service pod uses 33–53 MB of memory against a 256 MB limit, and the node sits at 45% memory with k3s, Docker and the app all running.
What “normal” looks like
To have something to compare against, I counted responses over one minute:
kubectl -n shop logs deploy/loadgen --since=1m | awk '{print $3}' | sort | uniq -c
48 200
11 404
That’s about 60 requests a minute: roughly 80% successful orders and 20% 404s from the sushi orders. Every experiment below is compared against this.
Breaking it on purpose
Each experiment changes one thing and watches the load generator’s responses for a minute. They’re small, but each one mirrors a pattern that shows up in real incidents.
1. Killing a pod
kubectl -n shop delete pod <one inventory pod> --wait=false
16:29:53 inventory-service-5b9df5fb7c-855m2 0/1 ContainerCreating 0s
16:29:53 inventory-service-5b9df5fb7c-pb8t5 1/1 Terminating 2m57s
16:29:54 inventory-service-5b9df5fb7c-855m2 0/1 Running 1s
16:29:59 inventory-service-5b9df5fb7c-855m2 1/1 Running 6s
Responses in that minute: 47 × 200, 12 × 404. No failures at all.
Kubernetes created the replacement pod in the same second, and it was ready for traffic 6 seconds later. The load generator didn’t notice: the second replica carried every request while the new pod started.
One detail stood out. The new pod was Running after 1 second, but only ready (1/1) after 6. That gap is the readiness probe at work: Kubernetes held traffic back until the app answered its health check. Without it, requests would have reached a pod whose app hadn’t started yet.
2. Making 30% of inventory requests fail
kubectl -n shop set env deploy/inventory-service FAIL_RATE=0.3
| Response | Normal | 30% errors |
|---|---|---|
200 |
47 | 39 |
404 |
12 | 8 |
502 |
0 | 12 |
16:43:38 burger 200
16:43:39 pizza 200
16:43:40 biryani 502
16:43:41 dosa 200
16:43:42 sushi 502
16:43:43 burger 200
About one in five orders now failed with 502. Two things are worth noticing.
First, the error changed shape on the way through. The inventory service returned 503, but users saw 502 from the order service. If you only looked at the order service’s errors, you’d blame the wrong service.
Second, the 404s dropped from 12 to 8. Some sushi orders, which should have returned an honest “unknown item”, came back as 502 instead (look at 16:43:42). The failure hid the real answer.
The error rate was closer to 20% than 30% because each request is a coin flip, and one minute is a small sample. Re-applying the YAML files put everything back in 15 seconds, replacing one pod at a time with no downtime.
3. Adding a 4-second delay
Nothing was broken. Every order failed.
kubectl -n shop set env deploy/inventory-service EXTRA_LATENCY_MS=4000
| Normal | 4 s delay | |
|---|---|---|
200 |
47 | 0 |
404 |
12 | 0 |
502 |
0 | 15 |
| Requests per minute | 59 | 15 |
16:53:13 biryani 502
16:53:17 dosa 502
16:53:21 sushi 502
16:53:25 burger 502
16:53:29 pizza 502
The inventory service didn’t return a single error. It was just slow. But the order service gives up after 3 seconds, so a 4-second delay became a 100% failure rate.
Throughput dropped too. The log lines are exactly 4 seconds apart: 3 seconds waiting for the timeout, plus the load generator’s 1-second pause. Requests fell from 59 a minute to 15.
And while every order was failing:
NAME READY STATUS RESTARTS AGE
inventory-service-756955545c-hnvzk 1/1 Running 0 2m25s
inventory-service-756955545c-p8q8h 1/1 Running 0 2m17s
loadgen-6b847654cc-k47wq 1/1 Running 0 4m42s
order-service-5854d44c69-j7k8c 1/1 Running 4 (33m ago) 13d
order-service-5854d44c69-xpp2m 1/1 Running 4 (33m ago) 13d
Every pod was 1/1 Running, with no new restarts. The health check endpoint has no delay, so it kept passing. As far as Kubernetes was concerned, everything was healthy.
This is the most important result of the four. Health checks tell you whether a process is alive. They don’t tell you whether the service is actually working. Re-applying the YAML recovered it in 12 seconds.
4. Taking the inventory service away
kubectl -n shop scale deploy/inventory-service --replicas=0
| Normal | No inventory | |
|---|---|---|
200 |
47 | 0 |
404 |
12 | 0 |
502 |
0 | 15 |
| Requests per minute | 59 | 15 |
I expected this one to fail fast. With no inventory pods at all, I assumed the order service would get “connection refused” straight away and the request rate would stay close to normal.
It didn’t. The results were identical to experiment 3: every order failed, and only 15 requests got through in a minute. Each request hung until the 3-second timeout. On this cluster, a missing service looked exactly like a slow one.
Kubernetes saw nothing wrong here either. The inventory Deployment showed 0/0, which counts as healthy, because zero is exactly what I asked for. Recovery took 7 seconds.
All four together
| Experiment | What users saw | Requests/min | What Kubernetes showed | Recovery |
|---|---|---|---|---|
| Normal | 80% 200, 20% 404 |
59 | All healthy | — |
| 1. Kill a pod | No change | 59 | New pod ready in 6 s | 6 s |
| 2. 30% errors | ~20% 502, some 404s became 502 |
59 | All healthy | 15 s |
| 3. 4 s delay | 100% 502 |
15 | All healthy | 12 s |
| 4. No inventory | 100% 502 |
15 | 0/0, treated as healthy |
7 s |
In three of the four experiments, users were affected. In all three, Kubernetes reported nothing wrong.
Kubernetes did its own job well: it replaced the killed pod in 6 seconds. But its health checks answer “is the process alive?”, not “is the service working for users?”
What went wrong
1. I switched off my own load generator.
Between sessions, I keep the load generator’s YAML at replicas: 0, so it doesn’t run when I’m not using the lab. During the experiments, I re-applied my YAML files to undo a change, and that quietly switched the load generator off too.
The next experiment ran with no traffic at all. No errors, no requests. It looked exactly like a healthy system with no users. I only caught it because I checked the load generator before the next run.
2. kubectl get pods -w showed nothing.
I’d left out -n shop, so it was watching the empty default namespace. A small thing, but a reminder that a quiet screen doesn’t always mean nothing is happening.
What I learned
1. Self-healing only works with more than one replica.
Kubernetes replaced the killed pod in 6 seconds, but users didn’t notice because a second replica was already serving. With one replica, those 6 seconds would have been an outage.
2. The service that fails isn’t always the one users see failing.
Inventory failed with 503; users saw 502 from the order service. Errors travel upstream and change shape, so the first error you see is often not where the problem started.
3. Every timeout is a decision about when slowness becomes an error.
A 3-second timeout turned a 4-second delay into a total outage. Timeouts are necessary, but each one is a choice, and it’s worth knowing where yours are set.
4. No errors isn’t the same as healthy.
My switched-off load generator produced no errors at all. Neither did the 0/0 Deployment, from Kubernetes’ point of view. Silence can mean everything is fine, or that nothing is happening.
5. The RESTARTS column needs context.
Three restarts looked like three crashes, but they were the nightly stop and start. A number on its own rarely tells the whole story.
A note on how I built this: I used Claude as a pair to write the app code and the setup guide. The decisions, running the experiments and breaking things were mine.
What’s next?
Throughout these experiments, all I had was a log of response codes from the load generator. It told me that orders were failing, but not where the problem started or why. In experiments 3 and 4, a slow service and a missing service looked exactly the same from the outside.
In Part 3, I’ll add Prometheus and Grafana to the lab and replay the same four failures. This time, I want to see them on dashboards. Things like request rates, error rates and latency for each service, and whether the metrics can tell a slow dependency apart from a missing one.
The monitoring stack will need more memory than the app itself, so the lab is also about to get a bigger instance.
After that, the series moves on to SLOs and burn-rate alerts on the same app. Experiment 3 is going to burn through an error budget very quickly.
The code is on GitHub if you want to break it yourself.