Skip to content

feat(ai): pinned image tags and bounded shared valkey in the llm stack #711

Description

@dan-petty

Context & Rationale

k8s/llm/portkey/deployment.yaml:32 ran :latest with imagePullPolicy: IfNotPresent, so each node kept whichever build it pulled first, until #738 pinned it to portkeyai/gateway:1.15.0. LightLLM, the other :latest workload, was removed in #727. Every workload image under k8s/ now has an explicit tag, but nothing stops a :latest tag from coming back. k8s/llm/valkey.yaml:40-47 starts the shared Valkey with no --maxmemory and no eviction policy under a 2048Mi limit. LiteLLM (gateway/deployment.yaml:60), Portkey (portkey/deployment.yaml:46) and Open WebUI websockets (values-open-webui.yaml:47) all write to it. The bundled knowledge base says to always set both (valkey.md:132), and k8s/llm/valkey-runs.yaml:80-81 already does (512mb, noeviction). No test asserts either manifest. No CI step runs Checkov or kube-linter. The native fallback checks only Dockerfile FROM tags (security/checkov.py:53), and devops k8s lint prints "passed" when kube-linter is absent (commands/k8s/security_audit.py:92).

Scope & Deliverables

  • Context & Rationale*: k8s/llm/portkey/deployment.yaml:32 ran :latest with imagePullPolicy: IfNotPresent, so each node kept whichever build it pulled first, until fix(k8s): restore kubernetes cpu metrics and align monitoring dashboards to homelab-k3s (#737) #738 pinned it to portkeyai/gateway:1.15.0. LightLLM, the other :latest workload, was removed in chore(ai): remove unused lightllm inference backend #727. Every workload image under k8s/ now has an explicit tag, but nothing stops a :latest tag from coming back. k8s/llm/valkey.yaml:40-47 starts the shared Valkey with no --maxmemory and no eviction policy under a 2048Mi limit. LiteLLM (gateway/deployment.yaml:60), Portkey (portkey/deployment.yaml:46) and Open WebUI websockets (values-open-webui.yaml:47) all write to it. The bundled knowledge base says to always set both (valkey.md:132), and k8s/llm/valkey-runs.yaml:80-81 already does (512mb, noeviction). No test asserts either manifest. No CI step runs Checkov or kube-linter. The native fallback checks only Dockerfile FROM tags (security/checkov.py:53), and devops k8s lint prints "passed" when kube-linter is absent (commands/k8s/security_audit.py:92).
  • Deliverable*: One PR. No image needs pinning: LightLLM was removed in chore(ai): remove unused lightllm inference backend #727, and fix(k8s): restore kubernetes cpu metrics and align monitoring dashboards to homelab-k3s (#737) #738 pinned Portkey. In k8s/llm/valkey.yaml, add --maxmemory below the 2048Mi limit and --maxmemory-policy volatile-lru, mirroring valkey-runs.yaml. Assert the flag pair for both manifests in tests/test_k8s_valkey_stack.py. Commit k8s/.checkov.yaml (framework: kubernetes, check: CKV_K8S_14, skip-path: coredns/deployment-patch.yaml) and add one CI step that runs a pinned Checkov over k8s/. Checkov finds the file itself and exits non-zero on failure. No wrapper change is needed. devops scan report --scanner checkov --fail-on already exits 1 for local use (commands/scan.py:851-852), and devops valkey info --section memory already prints the memory fields.
  • Constraint*: Routing CI through the devops wrapper would fail open. When the binary is missing, the wrapper silently runs the native fallback (security/base.py:93-97), which has no k8s tag check. That fix belongs with the delivered fix(review): the static scan reports a clean result when its scanners are not installed #516 analyzer states (ai/review/pipeline.py:845) and the Gate Integrity draft, not here. The coredns patch has no image and no kustomization renders it, so it is skipped by path. allkeys-lru could evict Open WebUI's websocket state. volatile-lru evicts only keys with a TTL and refuses writes when none remain, which is better than an OOM kill. Digest pinning (CKV_K8S_43) fails on every workload, and Dependabot covers only github-actions and pip. Digests therefore wait for Finding Baseline for Incremental Scan Gate Adoption and a Kubernetes-aware updater such as Renovate. A 0.0.0.0 rule is wrong here, because in-pod servers must listen on all interfaces. Host exposure comes from NodePort services, most documented as local-minikube choices. Ollama now runs as the per-VRAM-tier DaemonSets in k8s/llm/profiles/ollama-profiles.yaml, which replaced k8s/llm/ollama.yaml and set no hostPort. Compose ${VAR:?} and loopback checks have no target in devops-cli.
  • Measured*: uvx --from checkov==3.3.19 checkov -d k8s --framework kubernetes --check CKV_K8S_14,CKV_K8S_43 -o json: CKV_K8S_14 failed in 3 files (lightllm, portkey, coredns patch). CKV_K8S_43 failed in 13, with none passing. The same Checkov over a copy of k8s/ with the proposed .checkov.yaml gave 2 failures and a non-zero exit. These counts predate chore(ai): remove unused lightllm inference backend #727 (LightLLM removed) and fix(k8s): restore kubernetes cpu metrics and align monitoring dashboards to homelab-k3s (#737) #738 (Portkey pinned). Only the coredns patch should now fail CKV_K8S_14, so the run with the proposed .checkov.yaml should pass. Re-measure before quoting new figures. grep -rEn '^\s*type: NodePort' k8s | wc -l gave 10 when filed and gives 6 now.
  • Source*: vibes resources/docker-compose/docker-compose.yml, vibes resources/docker-compose/.env.example, vibes resources/k8s/observability/valkey-statefulset.yaml, vibes resources/k8s/observability/jaeger-deployment.yaml

Strategic Alignment

Proposed design

Problem statement

The Kubernetes LLM stack has two main issues: 1) It uses :latest Docker image tags that can lead to inconsistent deployments across nodes, and 2) The shared Valkey instance lacks memory limits which could cause out-of-memory errors under high load. These issues affect deployment consistency and system stability.

Acceptance criteria

  • Criterion 1: All Kubernetes manifests use pinned image tags instead of :latest
    Verification: Run grep -r ':latest' k8s/ and verify no results are returned
  • Criterion 2: Valkey manifests have --maxmemory and --maxmemory-policy configured
    Verification: Verify that k8s/llm/valkey.yaml includes --maxmemory 2048mb and --maxmemory-policy volatile-lru
  • Criterion 3: Test suite validates the Valkey configuration in all manifests
    Verification: Run pytest tests/test_k8s_valkey_stack.py and verify all tests pass
  • Criterion 4: Checkov CI step runs with proper configuration
    Verification: Verify that a CI step exists that runs checkov -d k8s --framework kubernetes --check CKV_K8S_14 with the proposed .checkov.yaml configuration

Key questions

  • Are all images under k8s/ already pinned to explicit tags?: Yes, every workload image under k8s/ now has an explicit tag, but nothing stops a :latest tag from coming back. [sources: k8s/llm/portkey/deployment.yaml:32]
  • What is the current Valkey memory configuration in k8s/llm/valkey.yaml?: It starts the shared Valkey with no --maxmemory and no eviction policy under a 2048Mi limit. [sources: k8s/llm/valkey.yaml:40-47]
  • What eviction policy should be used for Valkey?: volatile-lru evicts only keys with a TTL and refuses writes when none remain, which is better than an OOM kill. [sources: docs/agent/tasks/task-711-pinned-image-tags-and-bounded-shared-valkey-in-the-llm-stack.md:17]
  • What is the target memory limit for Valkey?: The 2048Mi limit should be maintained, with --maxmemory set below this limit. [sources: docs/agent/tasks/task-711-pinned-image-tags-and-bounded-shared-valkey-in-the-llm-stack.md:16]
  • Should we add a checkov configuration file?: Yes, commit k8s/.checkov.yaml with framework: kubernetes, check: CKV_K8S_14, and skip-path for coredns patch. (proposed) [sources: docs/agent/tasks/task-711-pinned-image-tags-and-bounded-shared-valkey-in-the-llm-stack.md:16]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added this to the v0.2.24 milestone on Sep 28, 2026
  2. added
    type/feature
    scope/ai
    priority/p2-medium
    on Sep 28, 2026
  3. modified the milestones: v0.2.24, v0.2.25 on Sep 30, 2026
  4. dan-petty commented on Sep 30, 2026

    @dan-petty
    OwnerAuthor

    Moved from v0.2.25 to the backlog. v0.2.25 is capped at 12 items (#740), and only the next two planned releases keep a milestone (#739), so P2 items wait in the backlog until reprioritization pulls them in.

  5. added
    scope/k8s
    and removed
    scope/ai
    on Oct 2, 2026
  6. added this to the milestone on Oct 17, 2026
  7. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

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

  8. removed this from the milestone on Oct 23, 2026
  9. dan-petty commented on Oct 24, 2026

    @dan-petty
    OwnerAuthor

    The premise of the item fails against the current codebase.

    Checkov does not find k8s/.checkov.yaml when invoked from the repository root without --config-file. When executed with --config-file k8s/.checkov.yaml -d k8s, Checkov 3.3.19 exits with code 1.

    Two workloads fail check CKV_K8S_14: k8s/devops/cronjob.yaml and k8s/devops/roadmap-service/deployment.yaml. Both specify ghcr.io/dan-petty/devops-cli/service without an image tag. These manifests were added in v0.2.26 after issue #711 was filed.

    According to k8s/README.md, Git keeps the service image untagged by design. Argo CD Image Updater dynamically writes the digest to Application.spec.source.kustomize.images. Adding image tags in Git contradicts this design.

    Adding k8s/devops workloads to skip-path is compensating code outside the item specification. The item cannot be built as written.

  10. added a commit that references this issue on Oct 24, 2026
    760b197
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/k8stype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions