Skip to content

fix(k8s): raise the limits that 7 d of use shows are too low #4991

Closed

Description

@dan-petty

Problem Description

On 2026-11-12 the owner said that the cluster limits look unnecessarily low. 7 days of Prometheus data show that some memory limits are near the peak use, and that some CPU limits throttle the container. Each limit is fixed today only after a kill (#4116, #4149, #2806, #1815, #2391, #4939). This item is rank 1 of the cluster integration plan #4989. It is a configuration fix that ships now and needs no owner step.

Reproduction Steps

  1. In Prometheus, read max_over_time(container_memory_working_set_bytes[7d]) and kube_pod_container_resource_limits{resource="memory"} for each container below.
  2. Read rate(container_cpu_cfs_throttled_periods_total[7d]) / rate(container_cpu_cfs_periods_total[7d]) for the exporters and the Service.
  3. Compare with the values in git (file and line in the table below).

Expected vs Actual Behavior

Expected: each memory limit has room above its 7 d peak, and a CPU limit does not throttle a container that uses a few millicores.

Actual (7 d to 2026-11-12):

  • Grafana peaked at 1014 MiB of its 1024Mi limit (99 %).
  • The LLM gateway serves every model call. It grows from 659 to 1333 MiB in 4 days between rollouts (65 % of 2048Mi, about +170 MiB a day).
  • alloy-logs is at 67 % of 512Mi and rising. alloy-metrics peaks at 72 % of 1024Mi.
  • The redis_exporter sidecars use 11 to 19 millicores, but CFS throttles them in 57 to 73 % of periods. node-exporter is throttled in 29 to 31 % of periods. Their scrapes take 0.26 to 2.0 s, against 0.04 s for a target that is not throttled.
  • roadmap-service reaches 1.00 core at its 1-core limit. It has one event loop, so the gain is for subprocess and native-thread bursts only.

Limits are not reserved on the node, and node memory use is 18 to 30 %. So the raises cost no scheduling room.

Proposed Fix

One pull request. Requests stay the same, except the Grafana memory request.

Container File and line Now New
grafana memory k8s/monitoring/grafana-values.yaml 17-23 request 256Mi, limit 1024Mi request 512Mi, limit 2Gi
llm-gateway memory k8s/llm/gateway/deployment.yaml 126 2048Mi 4Gi
alloy-metrics memory k8s/monitoring/k8s-monitoring-values.yaml 356 1024Mi 1536Mi
alloy-logs memory k8s/monitoring/k8s-monitoring-values.yaml 385 512Mi 768Mi
redis_exporter CPU k8s/llm/valkey.yaml 138, k8s/llm/valkey-devops.yaml 138, k8s/argocd/values.yaml 99 100m 500m
node-exporter CPU k8s/monitoring/k8s-monitoring-values.yaml 308 200m 500m
roadmap-service CPU k8s/devops/roadmap-service/deployment.yaml 139 1 2
  • Tempo stays at 2Gi (7 d peak 76 %). The near-limit rule of dan-petty/homelab#344 watches it.
  • Do not set MAX_REQUESTS_BEFORE_RESTART on the gateway. With one uvicorn worker and one replica, every model call fails until the container restarts.
  • Put the before values in a pull-request comment: the 7 d peak against the limit, the throttled share, and the Service event-loop lag or round time.

Environment Diagnostics

Homelab k3s cluster, Argo CD syncs main. Data: Prometheus (cAdvisor and kube-state-metrics) for the 7 d to 2026-11-12. Study: read-only kubectl get, describe and top.

Acceptance Criteria

  • Git holds the values of the table, and tests/invariants/test_k8s_*.py and kubeconform pass.
  • A pull-request comment records the before values.
  • 7 d after the merge, a second comment records the peak against the new limit and the throttled share for each container.

Dependencies

None. dan-petty/homelab#344 (workload alerts) and #4992 (KRR) come after this item.

Source: #4989

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/bug
    scope/k8s
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
    • Related: fix(k8s): raise the memory limit of roadmap-service #4149, which asks for a different change. Both raise a roadmap-service resource limit, but dan-petty/devops-cli#4149 fixes its memory limit after OOM kills while the candidate raises its CPU limit (1 to 2) among seven other containers.
  4. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 12, 2026
  5. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  6. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor
  7. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 12:40 UTC

  8. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Open criterion: the comment 7 days after the merge

    This issue closed when #5030 merged (2026-11-12T12:09:50Z), but the third acceptance criterion is still open: "7 d after the merge, a second comment records the peak against the new limit and the throttled share for each container."

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

    effort/lowpriority/p2-mediumscope/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions