It adds a /health endpoint. The endpoint provides a simple JSON response indicating the health status of the service, allowing Kubernetes to monitor if the service is running properly.
Implementation Details
/health Endpoint:
Added a new /health route in service/routes.py.
The /health endpoint returns a JSON response {"status": "OK"} with an HTTP status code 200_OK.
This endpoint is intended for use by Kubernetes liveness and readiness probes to check the service's health status.
Kubernetes Health Probes:
Liveness Probe: Checks if the app is alive; restarts the container if it fails.
Path: /health, Port: 8080
Delay: 15s, Interval: 20s
Readiness Probe: Checks if the app is ready to receive traffic; marks the Pod as unready if it fails.
Path: /health, Port: 8080
Delay: 5s, Interval: 10s
Acceptance Criteria
[x] The /health endpoint returns {"status": "OK"}.
[x] The HTTP status code is 200_OK.
[x] Liveness and readiness probes are configured in deployment.yaml to use the /health endpoint.
Testing
Manually tested the /health endpoint to verify it returns the correct JSON response and status code.
Automated tests added in tests/test_routes.py to ensure the /health endpoint behaves as expected.
Verified the Kubernetes probes work as expected by observing the Pod behavior during testing.
Description
It adds a
/health
endpoint. The endpoint provides a simple JSON response indicating the health status of the service, allowing Kubernetes to monitor if the service is running properly.Implementation Details
/health
Endpoint:/health
route inservice/routes.py
./health
endpoint returns a JSON response {"status": "OK"} with an HTTP status code 200_OK./health
, Port: 8080/health
, Port: 8080Acceptance Criteria
/health
endpoint returns {"status": "OK"}.Testing
/health
endpoint to verify it returns the correct JSON response and status code.tests/test_routes.py
to ensure the/health
endpoint behaves as expected.