Skip to content

fix(k8s): the llm valkey cache requires a password and admits only its clients, like valkey-runs #1654

Closed

Description

@dan-petty

Friction

The shared Valkey in llm (deployment/valkey) accepts commands from anyone, with no password, while valkey-runs in the same namespace requires one. Every pod in llm, every pod in monitoring and Traefik can reach it on any port, so any of them can read or overwrite Open WebUI's state, publish on Open WebUI's task-command pub/sub channel, or read and poison Portkey's response cache.

Evidence

Live, read-only, 2026-10-17:

  • Deployment llm/valkey (valkey/valkey:9.1.2-alpine) runs valkey-server --save "" --appendonly no --dir /data: no env, no requirepass, no Secret reference. Service llm/valkey is ClusterIP.
  • The valkey image patches protected-mode off at build time, and Open WebUI's connections work unauthenticated (no Redis error logged in the two weeks since start-up).
  • Secrets in llm (names only): llm-gateway-secrets, qdrant-api-key, valkey-runs-auth; none for this Valkey.
  • NetworkPolicy llm/llm-default-perimeter (k8s/llm/networkpolicy.yaml:9-36) selects valkey and admits podSelector {}, the whole monitoring namespace and Traefik, with no port limit.
  • Clients: StatefulSet llm/open-webui sets REDIS_URL and WEBSOCKET_REDIS_URL to redis://valkey.llm.svc.cluster.local:6379/0; Portkey uses CACHE_STORE=redis with the same host; llm-gateway sets LITELLM_REDIS_HOST/PORT, though litellm_settings (k8s/llm/gateway/configmap.yaml:151-157) turns on no cache.

Repo:

Remedy

  1. Tests first (tests/test_k8s_valkey_stack.py): the valkey Deployment reads VALKEY_PASSWORD from Secret valkey-auth and never passes the password on the command line; Open WebUI, Portkey (and the gateway, if it keeps a Redis setting) take the password from the same Secret; a valkey-perimeter admits 6379 only from open-webui, portkey and llm-gateway.
  2. Secret llm/valkey-auth (key password) joins the push-secrets registry from a keyring entry (adopt the live value if present, else generate), with a row in the Cluster Secrets table (k8s/README.md around :315); deploy-stack pushes it before applying valkey.yaml.
  3. k8s/llm/valkey.yaml:40-47: copy the valkey-runs pattern (valkey-runs.yaml:66-87): requirepass written into a config file on a memory emptyDir with umask 077, then exec valkey-server /run/valkey/auth.conf --save "" --appendonly no --dir /data.
  4. Clients: Open WebUI declares VALKEY_PASSWORD from a secretKeyRef first and builds the valkey Service URL with that password interpolated into its userinfo for both URLs (check the chart renders the env vars in that order); Portkey's REDIS_URL the same; remove LITELLM_REDIS_HOST/PORT from the gateway if no LiteLLM cache uses them.
  5. Network, as defence in depth: add valkey to the NotIn list in k8s/llm/networkpolicy.yaml:13-16 and give it its own perimeter as in step 1.
  6. k8s/README.md:67 passes auth; Coordinate the file edit with feat(ai): pinned image tags and bounded shared valkey in the llm stack #711.
    Verification after the sync: an unauthenticated PING is refused with NOAUTH, Open WebUI chat and websockets work, and Portkey logs no cache errors.

Priority: P3. Severity low: ClusterIP only, but an unauthenticated write path from two namespaces into Open WebUI's state.

Proposed design

Problem statement

The llm Valkey deployment in the Kubernetes cluster is insecure because it lacks authentication and allows unrestricted access from any pod in the namespace. This exposes Open WebUI's state and Portkey's response cache to unauthorized read and write operations.

Acceptance criteria

  • Criterion 1: The Valkey deployment reads a password from a Secret and does not expose it on the command line
    Verification: Check that k8s/llm/valkey.yaml uses a config file with requirepass from a memory emptyDir volume instead of passing password via command line
  • Criterion 2: Open WebUI, Portkey, and gateway clients use the same password from the valkey-auth Secret
    Verification: Verify that k8s/llm/values-open-webui.yaml, k8s/llm/portkey/deployment.yaml, and k8s/llm/gateway/deployment.yaml reference VALKEY_PASSWORD from the secret
  • Criterion 3: NetworkPolicy restricts Valkey access to only specific pods
    Verification: Confirm that a new valkey-perimeter NetworkPolicy allows traffic only from open-webui, portkey, and llm-gateway pods on port 6379
  • Criterion 4: Unauthenticated PING commands are rejected with NOAUTH error
    Verification: Run kubectl -n llm exec -it svc/valkey -- valkey-cli ping and verify it fails with NOAUTH error
  • Criterion 5: Open WebUI chat and websockets function correctly with authentication
    Verification: Verify that Open WebUI chat functionality works without errors after applying the changes

Key questions

  • What is the current Valkey configuration in k8s/llm/valkey.yaml?: The current Valkey deployment runs with no password, using command line arguments '--save "" --appendonly no --dir /data' without any requirepass or secret reference. [sources: k8s/llm/valkey.yaml:40-47]
  • How is the valkey-runs deployment configured to handle passwords?: The valkey-runs deployment reads password from Secret 'valkey-runs-auth' into a config file on a memory emptyDir with umask 077 rather than passing it on command line. [sources: k8s/llm/valkey-runs.yaml:66-87]
  • Which pods need to access the Valkey instance?: Open WebUI, Portkey, and llm-gateway pods need access to the Valkey instance. [sources: k8s/llm/values-open-webui.yaml:66-72, k8s/llm/portkey/deployment.yaml:43-46, k8s/llm/gateway/deployment.yaml:60-63]
  • Should we add a valkey-perimeter NetworkPolicy?: Yes, a new NetworkPolicy should be added to restrict access to Valkey to only specific pods for defense in depth. (proposed)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/security
    on Oct 18, 2026
  2. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Type: type/security. The candidate addresses a security vulnerability by requiring a password for Valkey access.
    • Priority: P1-High. The issue allows unauthorized access to Open WebUI's state and pub/sub channels, posing a high risk.
    • Value: High. Fixing this vulnerability significantly improves system security and prevents unauthorized modifications.
    • Effort: High. The fix requires changes across multiple components including deployment files, secrets management, client configurations, and network policies.
  3. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at 25e2cda (see proposed design in issue body).

  4. added a commit that references this issue on Oct 23, 2026
    a752a14
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

    source/agenttype/security

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions