Skip to content

feat(k8s): give the gateway one deployment per Ollama node instead of one pinned Service connection #463

Closed

Description

@dan-petty

Problem

The gateway reaches Ollama through the ollama Service. kube-proxy balances per TCP connection and LiteLLM keeps its connections open, so all gateway traffic to Ollama goes to whichever pod the first connections landed on. During a full review, one Ollama node served 15 requests and the other served 0.

Because every Ollama node sits behind one gateway deployment, LiteLLM cannot see individual nodes:

  • max_parallel_requests is a guess for the Service as a whole. With OLLAMA_NUM_PARALLEL=1, two requests can land on the same node and queue there while another node sits idle.
  • A broken node (for example, one missing a model) fails some requests at random and is never cooled down, because its failures are counted against the Service deployment that covers every node.

The gateway's health report is also misleading. devops-embedding is reported unhealthy because it is probed with a generate call, and the ollama/* wildcard is probed with the placeholder model gpt-5-nano.

Proposal

  • Run Ollama as a StatefulSet with a headless Service, so each pod gets a stable DNS name (ollama-<n>.ollama-nodes). Required pod anti-affinity keeps one pod per GPU node. The architecture affinity, hostPort, node-local hostPath models, and the ollama Service (for Open WebUI, the CLI and pass-through) stay as they are.
  • In the gateway, give devops-chat, devops-embedding and the Ollama tier of devops-review one deployment per pod, each with max_parallel_requests: 1.
  • Health checks: mode: embedding for embedding deployments, and a real health_check_model for the wildcard.
  • A test keeps the per-pod gateway deployments in step with the StatefulSet's replica count.

Acceptance criteria

  • During a review, gateway requests reach every Ollama node.
  • /health reports every Ollama deployment healthy.
  • Open WebUI, devops k8s port-forwards, and host access on port 11434 keep working.

Activity

  1. added this to the v0.2.23 milestone on Sep 23, 2026
  2. added
    type/feature
    scope/ai
    scope/k8s
    priority/p2-medium
    on Sep 23, 2026
  3. added 2 commits that reference this issue on Sep 23, 2026
    83005f8
    7ff4355
  4. dan-petty commented on Sep 23, 2026

    @dan-petty
    OwnerAuthor

    Closed by #464, merged into release/v0.2.23.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  5. added a commit that references this issue on Sep 28, 2026
    ea49d6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2-mediumscope/aiscope/k8stype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions