---
title: "Health Drain"
method: GET
path: "/health/drain"
tags: ["health"]
---

# Health Drain

`GET /health/drain`

Graceful-drain probe for Kubernetes ``preStop`` hooks.

Disabled by default and returns 404 unless ``general_settings`` sets
``enable_drain_endpoint: true``. Calling it flips a process-wide
shutting-down flag, so a successful call permanently takes the worker out
of rotation until the pod restarts.

Because the kubelet calls preStop hooks without proxy credentials, the
endpoint does not require ``user_api_key_auth``. To prevent any
pod-reachable caller from triggering shutdown, set
``general_settings.drain_endpoint_token`` (or the ``DRAIN_ENDPOINT_TOKEN``
env var) and supply the same value on the ``X-Drain-Token`` header from
the preStop hook. Calls without the header (or with a wrong value) get a
401 and have no side effect.

When enabled, it marks the worker as shutting down (so /health/readiness
and /health/liveliness immediately start returning 503, removing the pod
from service) and blocks until the in-flight request counter drains to
zero or ``GRACEFUL_SHUTDOWN_TIMEOUT`` elapses. Unlike a fixed ``sleep``,
this returns as soon as real in-flight work is done.

Wire it up as:

```yaml
lifecycle:
  preStop:
    httpGet:
      path: /health/drain
      port: 4000
      httpHeaders:
        - name: X-Drain-Token
          value: <same value as drain_endpoint_token>
```

## Response `200`

Successful Response

- unknown

## Changes

- **2026-09-18** `082b5fabd909` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/flock/apis/litellm-api/changes/health/drain/get.md)

---

[API](https://skmtc.dev/flock/apis/litellm-api.md) · [All operations](https://skmtc.dev/flock/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc.dev/flock/apis/litellm-api/revisions/7ed45f30a5f0?raw)
