Skip to content

fix(k8s): the volumes of grafana, the prometheus server and loki move off the control-plane node, and their placement exemptions go #2147

Closed

Description

@dan-petty

What happened

#1634 moves every local-path volume off the control-plane node, whose 236 GB root disk is about 79% used. On 2026-10-24 an agent moved Pyroscope, Qdrant and Open WebUI with the copy procedure of k8s/README.md (Local-Path Volume Placement), and checked each copy. It could not move Grafana (monitoring/grafana), the Prometheus server (monitoring/prometheus-server) and Loki (logging/storage-loki-0): the permission system of that session refused the scale to zero of Grafana. Their old volumes are set to Retain, and CONST_K8S_CONTROL_PLANE_CLAIM_EXEMPTIONS in src/devops_cli/config/constants.py exempts them from the placement test, so the merge of #1634 does not leave their pods Pending.

What should happen

A person (or a session where scaling these workloads is allowed) moves the three volumes to worker nodes with the README procedure, one at a time (Grafana, then Prometheus, then Loki), and checks each one: Grafana dashboards load, Prometheus has samples from before the move, Loki answers a query for the day before. Then the values get the control-plane DoesNotExist affinity (affinity for Grafana, server.affinity for Prometheus, singleBinary.affinity for Loki), and the three entries leave the exemption list.

Acceptance criteria

  • kubectl get pv shows the volumes of the three claims on worker nodes, with reclaim policy Retain.
  • CONST_K8S_CONTROL_PLANE_CLAIM_EXEMPTIONS is empty or gone, and tests/test_k8s_local_path_placement.py passes with no exemption.

Source: #1634

Proposed design

Problem statement

Grafana, Prometheus server and Loki volumes are on the control-plane node. This uses 79% of the 236 GB root disk. Moving these volumes off the control-plane node improves system stability.

Acceptance criteria

  • Criterion 1: kubectl get pv shows the volumes of the three claims on worker nodes, with reclaim policy Retain.
    Verification: Run 'kubectl get pv' and verify that grafana, prometheus-server and storage-loki-0 volumes are on worker nodes and have reclaim policy Retain.
  • Criterion 2: CONST_K8S_CONTROL_PLANE_CLAIM_EXEMPTIONS is empty or gone, and tests/test_k8s_local_path_placement.py passes with no exemption.
    Verification: Check that CONST_K8S_CONTROL_PLANE_CLAIM_EXEMPTIONS in src/devops_cli/config/constants.py is empty or removed. Run tests/test_k8s_local_path_placement.py to verify it passes without exemptions.

Key questions

  • Which three volumes are currently on the control-plane node?: The volumes are grafana in monitoring namespace, prometheus-server in monitoring namespace, and storage-loki-0 in logging namespace. [sources: k8s/README.md]
  • What is the procedure to move a volume to another node?: Use 'devops k8s volume move /' command with the README procedure. The command copies data from old volume to new volume on worker node, scales workloads to zero during copy, and checks each copy. [sources: k8s/README.md]
  • What changes are needed after moving the volumes?: The affinity rules need to be added to Grafana, Prometheus server and Loki configurations. The entries must also be removed from CONST_K8S_CONTROL_PLANE_CLAIM_EXEMPTIONS in src/devops_cli/config/constants.py. (proposed) [sources: k8s/README.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

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

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Type: type/infra. The candidate is about Kubernetes volume placement and cluster infrastructure.
    • Priority: P1-High. Moving volumes off control-plane node improves system stability and disk usage.
    • Value: High. Improves resource utilization and avoids potential disk space issues on control-plane nodes.
    • Effort: Medium. Requires manual steps to move each volume and update configurations, but is not overly complex.
    • Related: fix(k8s): loki runs from the grafana-community chart on loki 3.7, out of reach of cve-2026-21729 #1632, which asks for a different change. Both items relate to Loki but ask for different changes: one moves volumes, the other updates Loki chart version.
  3. dan-petty commented on Oct 26, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at 48c78ca (see proposed design in issue body).

  4. added
    priority/p1-high
    status/ready
    effort/medium
    value/high
    on Oct 28, 2026
  5. 13 remaining items

  6. added
    owner/human
    on Nov 5, 2026
  7. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The three volumes moved on 2026-11-06, with devops k8s volume move at the merge of #3712. The runbook of the comment of 2026-11-05 ran to step 6.

    Claim Time New node Checks
    monitoring/grafana 55 s worker Pod Running 2/2, claim Bound with Retain, a dashboard search through the Grafana API answers
    monitoring/prometheus-server 4 min 35 s worker prometheus_tsdb_lowest_timestamp_seconds is the same before and after (1791201600), and the kubelet series has a sample in each minute of the stop
    logging/storage-loki-0 2 min 42 s worker Pod Running, a query for the day before returns logs, sum(loki_write_dropped_entries_total) is 1 before and after

    The first live try of Grafana on 2026-11-05 failed in the copy and undid itself with no data loss. #3695 and #3712 fixed the copy: the source stream ended before the destination had the data. These moves needed no retry.

    Criterion 1 holds. kubectl get pv shows the three claims on a worker node with reclaim policy Retain. Argo CD shows bootstrap, cluster, grafana, prometheus and loki Synced and Healthy.

    What stays for a person (step 9). Each old volume is Released on the control-plane node and keeps its data. After you no longer need it, delete it with the command that the move printed, then read the free space of the root disk (#3654):

    kubectl --context homelab-k3s patch pv pvc-c54a286c-66fe-4c27-97b7-c8c142991934 -p '{"spec": {"persistentVolumeReclaimPolicy": "Delete"}}'   # grafana
    kubectl --context homelab-k3s patch pv pvc-57243fd7-2c26-4084-b354-0e19c1865bc2 -p '{"spec": {"persistentVolumeReclaimPolicy": "Delete"}}'   # prometheus
    kubectl --context homelab-k3s patch pv pvc-c810255f-025e-4e94-91fe-1a1a691bf79e -p '{"spec": {"persistentVolumeReclaimPolicy": "Delete"}}'   # loki
    

    Then kubectl delete pv <name> for each. The saved claims are under .data/k8s/volume-move/ on the workstation.

    The item is now released, so the repository change (the affinity of the three values and the empty exemption table) can be built.

  8. added
    owner/agent
    and removed
    owner/human
    on Nov 6, 2026
  9. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    Answer from project standards, under the owner's instruction of 2026-11-05.

    The volumes moved on 2026-11-06 (comment of that date), so I built groups 1 and 2 of the plan in openspec/changes/2147-the-volumes-of-grafana-the-prometheus/. The commit is on branch fix/2147-the-volumes-of-grafana-the-prometheus. It is not pushed yet. I changed nothing in the cluster.

    Question 1. The issue names CONST_K8S_CONTROL_PLANE_CLAIM_EXEMPTIONS in src/devops_cli/config/constants.py. Which table does criterion 2 mean?

    Answer. That constant does not exist. The only table is _CONTROL_PLANE_CLAIM_EXEMPTIONS in tests/core/test_k8s_local_path_placement.py. The change empties it and keeps it, with its comment, so a later pod that must stay on the node has a place for its reason. The issue allows "empty or gone", and the empty table is the smaller change. The source: git grep -n CLAIM_EXEMPTIONS -- src tests k8s, and the base spec openspec/specs/local-path-volume-placement/spec.md (the scenario "An exemption is stale"). The change touches no file under src/.

    Question 2. The plan names lines 321 to 341 and line 337 of k8s/README.md. Is that right?

    Answer. No, the lines moved. I found the paragraph by the section name Local-Path Volume Placement, and I fixed the line numbers in the plan files. The paragraph now names tests/core/test_k8s_local_path_placement.py, says that the table is empty, and keeps the rule for a pod whose volume is still on the control-plane node.

    Question 3. Does this change supersede the plan pull request #2857?

    Answer. No. #2857 is merged (2026-10-31). It planned the item and closed nothing. This change builds on that plan, and the pull request of this change closes the issue.

    Checks (read only, 2026-11-06).

    • kubectl get pv: the bound volumes of monitoring/grafana, monitoring/prometheus-server and logging/storage-loki-0 are Retain and Bound on a worker node. kubectl get nodes -L node-role.kubernetes.io/control-plane prints true only for the control-plane node. The three old volumes are Released on the control-plane node.
    • helm template with the values of this change, against helm template with the values of origin/main, differs only by the affinity block. Grafana chart 14.0.1: the Deployment grafana (and the Helm test Pod). Prometheus chart 29.35.0: the Deployment prometheus-server; the Alertmanager StatefulSet is unchanged. Loki chart 20.0.2: the StatefulSet loki has the node affinity and keeps its podAntiAffinity on kubernetes.io/hostname.
    • With the table empty and the old values, uv run devops ci test tests/core/test_k8s_local_path_placement.py fails and lists exactly the three pods. With the affinity, it prints 9 passed. uv run devops ci fail-to-pass --base origin/main reports 1 failed on base (test_every_chart_pod_on_a_claim_keeps_off_the_control_plane_node) and 8 passed.
    • uv run devops ci test for the tests that read the three files (tests/invariants/test_k8s_manifests.py, tests/invariants/test_k8s_argocd_apps.py, tests/k8s, tests/commands/k8s, tests/prometheus, tests/grafana, tests/core/test_third_party_telemetry.py, tests/core/test_renovate_config.py, the placement test): 1385 passed. uv run devops ci docs, uv run devops openspec check and the k8s gate pass.

    What stays for a person.

    • Merge the pull request. Argo CD applies it and restarts each of the three pods one time on the node of its volume. The volumes are already on worker nodes, so no pod stays Pending. After the merge, make sure that the three pods are Running.
    • Delete the three old Released volumes when you no longer need their data (step 9 of the runbook; fix(k8s): free the root disk of the control-plane node #3654 holds the disk work).
  10. added
    status/in-progress
    status/in-review
    and removed
    status/planned
    status/in-progress
    on Nov 6, 2026
  11. removed
    status/in-review
    owner/agent
    on Nov 6, 2026
  12. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-06 04:26 UTC

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/mediumpriority/p1-highscope/k8ssource/agenttype/bugvalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions