Commit 7fa05c1
Add Kubernetes probe configuration guidance to deployment docs (#3803)
## Summary
Added Kubernetes health probe configuration guidance to the deployment
documentation, explaining why readiness probes need special handling
when Electric returns HTTP 202 during startup.
**User impact:** Kubernetes operators can now properly configure probes
to avoid routing traffic to Electric pods that are still initializing.
## Approach
The core issue: Kubernetes `httpGet` probes treat *any* 2xx response as
success. Electric's health endpoint returns:
- `200 OK` with `{"status":"active"}` when fully ready
- `202 Accepted` with `{"status":"waiting"}` during startup
This means a naive `httpGet` readiness probe marks pods as ready while
Electric is still initializing—potentially routing traffic to pods that
will return errors.
**Solution:** Different probe types for different purposes:
- **Liveness:** Use standard `httpGet` (any response = alive)
- **Readiness:** Use `exec` with curl to check for exactly HTTP 200
```yaml
readinessProbe:
exec:
command:
- sh
- -c
- |
test "$(curl -so /dev/null -w '%{http_code}' http://localhost:3000/v1/health)" = "200"
```
## Key Invariants
1. Readiness probe must only succeed when Electric returns exactly HTTP
200
2. Liveness probe should succeed on any response (including 202)
3. Electric container must include `curl` (it does)
## Non-goals
- Not adding custom health check endpoints to Electric itself
- Not changing Electric's health response behavior (202 during startup
is correct)
## Trade-offs
**Alternative considered:** Could document using `tcpSocket` probes
instead. Rejected because:
- TCP connection success doesn't indicate application readiness
- HTTP-level check provides more meaningful health signal
**Alternative considered:** Suggest users build custom sidecar
containers for health checking. Rejected as overly complex when a simple
exec probe suffices.
## Verification
```bash
# View the documentation changes
pnpm --filter @electric-sql/docs dev
# Navigate to /docs/guides/deployment and check the Kubernetes probes section
```
## Files Changed
| File | Change |
|------|--------|
| `website/docs/guides/deployment.md` | Added "Kubernetes probes"
subsection with liveness/readiness probe YAML examples and explanation |
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8da1c1f commit 7fa05c1
1 file changed
+34
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
186 | 220 | | |
187 | 221 | | |
188 | 222 | | |
| |||
0 commit comments