Deploy a service with a health endpoint
In this article (3 sections)
A health endpoint lets platforms and operators see whether an instance can run and accept work. It should be fast, minimal and free of secrets.
Evaluate fixture health
The integration lab computes health from process, database and migration state.
from integration_cases import health_case
result = health_case()
assert result["liveness"] == 200
assert result["readiness"] == 200
assert result["health_body"] == {"status": "ready", "version": "fixture-v1"}
assert result["deployed"] is FalseNo deployment or HTTP server ran.
Use dedicated endpoints for process liveness and traffic readiness. Readiness may check required dependency connectivity and schema state with tight timeouts; liveness should not restart healthy code because a remote database briefly fails. Return small bodies and stable statuses.
Include release identity but not credentials, host internals or dependency responses. Test startup, dependency outage, overload and graceful shutdown. Wire platform probes and external synthetic monitoring separately.
The FDE for Freshers course requires health evidence in the deployed integration artifact.
Exercise
Add /live and /ready to a local service, toggle a fake dependency and prove traffic readiness fails while process liveness remains healthy.
Continue learning
This article is part of the FDE integration and deployment foundations sequence. Use the neighbouring tasks when you need the prerequisite or the next application.
- Review the prerequisite or neighbouring task in Create a CI workflow that runs meaningful tests.
- Continue with Separate liveness and readiness checks.
Reference: Kubernetes probe documentation.
Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.
This article is part of our FDE for Freshers programme — 6–7 months. Build your engineering foundations, then take AI from discovery to delivery.
Explore FDE for Freshers