Skip to content

Commit cdcccfe

Browse files
yroblaclaude
andcommitted
Clarify Redis session routing is conditional on Redis being configured
When backendReplicas > 1, the proxy runner only uses Redis for session-to-pod routing when Redis session storage is actually configured. The previous wording implied Redis was always used, then contradicted itself in the next paragraph. Closes #727 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 81c5e7d commit cdcccfe

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

docs/toolhive/guides-k8s/run-mcp-k8s.mdx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,25 @@ The proxy runner handles authentication, MCP protocol framing, and session
453453
management; it is stateless with respect to tool execution. The backend runs the
454454
actual MCP server and executes tools.
455455

456+
### Session routing for backend replicas
457+
458+
MCP connections are stateful: once a client establishes a session with a
459+
specific backend pod, all subsequent requests in that session must reach the
460+
same pod. When `backendReplicas > 1` and Redis session storage is configured,
461+
the proxy runner uses Redis to store a session-to-pod mapping so every proxy
462+
runner replica knows which backend pod owns each session.
463+
464+
When Redis session storage is configured and a backend pod is restarted or
465+
replaced, its entry in the Redis routing table is invalidated and the next
466+
request reconnects to an available pod — sessions are not automatically migrated
467+
between pods.
468+
469+
Without Redis session storage, the proxy runner relies on Kubernetes client-IP
470+
session affinity on the backend Service. Client-IP affinity is unreliable behind
471+
NAT or shared egress IPs, and there is no shared session-to-pod mapping, so a
472+
pod restart or replacement can silently misroute subsequent requests to the
473+
wrong pod.
474+
456475
Common configurations:
457476

458477
- **Scale only the proxy** (`replicas: N`, omit `backendReplicas`): useful when
@@ -486,9 +505,10 @@ replica management to an HPA or other external controller.
486505

487506
:::note
488507

489-
The `SessionStorageWarning` condition fires only when `spec.replicas > 1`.
490-
Scaling only the backend (`backendReplicas > 1`) does not trigger a warning, but
491-
backend client-IP affinity is still unreliable behind NAT or shared egress IPs.
508+
The `SessionStorageWarning` condition fires only when `spec.replicas > 1`
509+
(multiple proxy runner pods). It does not fire when only `backendReplicas > 1`,
510+
but client-IP affinity is unreliable behind NAT or shared egress IPs — Redis
511+
session storage is strongly recommended whenever `backendReplicas > 1`.
492512

493513
:::
494514

0 commit comments

Comments
 (0)