Skip to main content

Health Check Says 200 OK but Users See Errors: How to Fix It

Updated 7 min readMarkdown

The dashboard was all green. Every health check said 200 OK. And customers could not place a single order.

This is one of the most common production problems I have seen in 14+ years of working with cloud and DevOps teams. It is also a great interview question, because the answer shows whether you have really run systems in production or only read about them.

Let me walk you through what happened, why it happened, and how to design health checks that actually tell you the truth.

The story: green dashboards, broken checkout

The database password was rotated late at night as part of a routine security task. The new password was updated in the secrets store, but one service was still reading the old value from its environment when new pods started.

The app started without any problem. The web server was listening on port 8080. The health check endpoint looked like this:

@app.get("/health")
def health():
    return {"status": "ok"}

That endpoint only proved one thing: the web process was running. It never checked the database.

So this is what happened:

  • The load balancer saw 200 OK from every instance and kept sending traffic to all of them.
  • Kubernetes saw every pod as healthy, so nothing restarted.
  • Our uptime monitor hit /health and was happy.
  • Every real request that needed the database failed.

For about 40 minutes, our monitoring said everything was fine. Customers told us before our alerts did.

Why this happens

A health check is a promise: "If I say I am healthy, you can send me traffic." Most teams write the first version on day one, when the app is small, and never revisit it.

There are three common mistakes:

  1. The check only proves the process is alive. It does not prove the instance can do its real job.
  2. One check is used for everything. The same endpoint decides restarts, load balancer traffic and alerting, even though these are different questions.
  3. Errors are hidden behind 200. Some APIs return HTTP 200 with an error inside the JSON body. Load balancers, dashboards and most monitors only look at the status code, so they think everything is fine.

Fix 1: Decide what "healthy" means

Before you write any code, answer this question: Can this instance actually serve a normal request right now?

For most web services that means:

  • The process is running.
  • It can reach its critical dependencies (database, cache, maybe a queue).
  • It has finished starting up (config loaded, migrations done, warm-up complete).

Not every dependency is critical. If your recommendation service is down, maybe you can still take orders. If the database is down, you cannot. Only check what would make the instance useless.

Fix 2: Split liveness and readiness

Kubernetes gives you separate probes, and you should use them for separate jobs.

  • Liveness asks: "Is this process stuck? Should I restart it?"
  • Readiness asks: "Should I send traffic to this pod right now?"
  • Startup asks: "Has the app finished starting yet?" (useful for slow-starting apps, so liveness doesn't kill them during boot)

Here is the important part: put dependency checks in readiness, not liveness.

If you put a database check in liveness and the database has a slow minute, Kubernetes restarts every pod at the same time. Now you have a database problem and a full application restart, with cold caches and a thundering herd of reconnections. You turned a small issue into a big outage.

With readiness, a pod that can't reach the database is simply taken out of the load balancer until it recovers. No restart storm.

livenessProbe:
  httpGet:
    path: /livez
    port: 8080
  periodSeconds: 10
  failureThreshold: 3
readinessProbe:
  httpGet:
    path: /readyz
    port: 8080
  periodSeconds: 5
  timeoutSeconds: 2
  failureThreshold: 2
startupProbe:
  httpGet:
    path: /livez
    port: 8080
  periodSeconds: 5
  failureThreshold: 30

And the endpoints:

@app.get("/livez")
def livez():
    # Only proves the process can answer. No dependency checks.
    return {"status": "alive"}

@app.get("/readyz")
def readyz():
    try:
        with db.connect(timeout=1) as conn:
            conn.execute("SELECT 1")
    except Exception:
        return JSONResponse({"status": "db unavailable"}, status_code=503)
    return {"status": "ready"}

On AWS, the same idea applies. Point your ALB target group health check at the readiness-style endpoint, so a broken instance stops getting traffic.

Fix 3: Keep health checks cheap

Health checks run all the time, from every load balancer node and every probe. A heavy check can become its own load problem.

  • Use a light query like SELECT 1, not a real business query.
  • Set a short timeout (1–2 seconds). A health check that hangs is worse than one that fails.
  • Don't call other services' health checks in a chain. If service A checks B, which checks C, one slow service makes everything look down.
  • Consider caching the dependency result for a few seconds if you have many instances.

Fix 4: Stop hiding errors behind 200

If your API does this:

HTTP/1.1 200 OK
{"success": false, "error": "payment failed"}

then every tool that looks at status codes thinks the request worked. Your error-rate graph stays flat while users are failing.

Use real status codes: 4xx for client problems, 5xx for server problems. Your load balancer metrics (like ALB HTTPCode_Target_5XX_Count), your APM and your SLO dashboards will finally show what users see.

Fix 5: Alert on what users feel

Even a perfect health check only tests one path. So add two more layers:

  • Real traffic signals: error rate and latency from actual requests (the "golden signals"). If the 5xx rate jumps, page someone, no matter what /health says.
  • Synthetic checks: a small script that runs a real user flow every minute, like log in, add to cart, start checkout, from outside your network. Tools like CloudWatch Synthetics, Datadog Synthetics or a simple scheduled job can do this.

In our incident, either of these would have caught the problem in a minute or two instead of 40.

What we changed after the incident

  • Split /health into /livez and /readyz, with the DB check only in readiness.
  • Pointed the load balancer at the readiness endpoint.
  • Fixed APIs that returned 200 on failure.
  • Added an alert on 5xx rate and a synthetic checkout test.
  • Added a step to the password rotation runbook: confirm new pods are Ready and a test transaction works.

The interview angle

A common question is: "Your health checks are green but users are seeing errors. What could be wrong, and how would you design health checks?"

A strong answer covers:

  1. The check only tests that the process is alive, not that it can serve requests.
  2. The difference between liveness, readiness and startup probes, and why dependency checks belong in readiness.
  3. Keeping checks cheap with short timeouts, and avoiding chained checks.
  4. Using correct HTTP status codes so errors are visible.
  5. Monitoring real user signals (error rate, latency, synthetic flows), not just /health.

If you can tell a short story like the one above, even better. Interviewers remember stories.

Key takeaway

A health check that can't fail is just decoration. Make it test what your users actually need, keep it light, and never let it be your only signal.


Let's connect: Free 15-min Cloud & DevOps Interview Guidance Call 👆 link in bio (topmate.io/cloudtechbydevang)

About the author

  • I help engineers learn cloud, DevOps, SRE and AI in simple English, crack interviews and follow clear roadmaps. 14+ years building and running platforms on AWS, GCP, Kubernetes and Terraform. One topic a day.

The point about not putting DB checks in liveness is worth calling out. Restarting every pod because the database is having a bad minute can make things much worse. Sometimes doing less is the better fix.

This is a clear explanation of a failure mode I have seen more than once. The distinction between liveness and readiness is the part I would stress most: putting the database check in readiness keeps a pod out of rotation without triggering a restart loop, while a liveness check on the same dependency can turn a short database slowdown into a thundering herd of cold starts. I also liked the point about the password rotation runbook. A rotation that is not verified with a real transaction and a Ready pod leaves the same gap in place. One addition I would make is to cache the readiness result for a few seconds, so a burst of probes does not add load to the database it is trying to protect.

The useful split here is that a 200 from a process-alive check is not a promise that the instance can do its real job. In the password-rotation story, the secrets store was updated, a service still started with the old value, and the load balancer, the scheduler, and the uptime monitor all stayed green because /health never touched the database. Putting the dependency check in readiness, not liveness, is the part that is easy to get backwards: a slow database minute should take a pod out of traffic, not restart every instance at once. Using a real 5xx when a request fails, and alerting on error rate or a synthetic checkout as well as the probe, keeps the dashboard from being the only voice in the room.

More from this blog