Skip to content

feat(k8s): move a claim to another storage class with volume move #7382

Done

Description

@dan-petty

Problem

devops k8s volume move NAMESPACE/CLAIM --to-node NODE moves a local-path claim to another node. It keeps the class of the old claim: _move_claim_manifest and the rebound claim take plan.storage_class from the old claim (src/devops_cli/k8s/volume_move.py:412, :1370). The homelab moves 16 claims from local-path to the replicated class longhorn (dan-petty/homelab#399, #390). The class of a claim is immutable, and a claim of volumeClaimTemplates must keep its name. So each of these moves needs the steps that the command already does (pause Argo CD from the top down, stop the workloads, copy with GNU tar, compare, rebind the claim name to the new volume, start, resume), with a different class.

Change

  • Add --storage-class CLASS to devops k8s volume move. The move claim and the rebound claim use CLASS. With CLASS, --to-node is optional: the destination pod selects a node by the class (for longhorn, a node with the label node.longhorn.io/create-default-disk=true), and the plan names the node that the scheduler gave.
  • --plan and --dry-run show the class of each claim.
  • The old volume keeps the reclaim policy Retain, as now.

Existing tool considered

pv-migrate (Apache-2.0) copies data between two claims with rsync, but it does not pause Argo CD, stop the workloads or rebind the old claim name. Velero restores a namespace with a class map, but it needs an install and a backup store for each move. The command of this repository already has each step except the class.

Acceptance criteria

  • A failing test first: a plan with --storage-class longhorn shows the move claim and the rebound claim with the class longhorn.
  • A live move of a test claim from local-path to longhorn ends with the claim name bound to a Longhorn volume, the data the same on both sides, and Argo CD resumed.
  • devops ci checks pass.

Alternatives check of 2026-11-27: partly.
Tool: utkuozdemir/pv-migrate (https://github.com/utkuozdemir/pv-migrate), Apache-2.0, last activity 2026-11-26, maintained.
Reason: Searches surfaced pv-migrate and Velero; pv-migrate copies data between two claims with rsync, but neither it nor Velero adds a class option to this command, pauses Argo CD, stops workloads, compares the sides or rebinds the old claim name.

Covers:

  • Copies data between two claims with rsync
  • Runs migrator pods inside the cluster
  • Per-claim moves driven from the CLI

Lacks:

  • No storage-class option for the destination claim
  • No Argo CD pause or workload stop
  • No rebind of the old claim name
  • No comparison of the two sides

Activity

  1. added
    type/feature
    scope/k8s
    source/agent
    status/new
    on Nov 27, 2026
  2. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor
  3. added
    value/medium
    effort/medium
    priority/p2-medium
    on Nov 27, 2026
  4. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor

    Finding from the Open WebUI move (dan-petty/homelab#461, 2026-11-27), for the design of this item:

    • The copy stream. The copy through the API server (kubectl exec … tar | kubectl exec -i … tar) stopped after about 1 minute with read tcp …:6443: i/o timeout. The target got a cut archive. A copy from pod to pod inside the cluster took 7 s for 532 MiB: the source pod served tar -c on a TCP port with Perl IO::Socket::INET, and the target pod read it with bash /dev/tcp. Both tools are in the copy image debian:trixie-slim. Pods of one namespace can reach each other under the homelab perimeter policies.
    • The order with a rebind. With a new claim name (existingClaim), Argo CD must be paused before the merge. If it is not paused, the workload starts on the empty claim, and with sign-up on, the first account on an empty database becomes admin. When this command rebinds the old claim name with the new class, a merge of the class change first is safe: Argo CD cannot change the class of the live claim (the field is immutable), so the workload keeps its data until the command moves it. So the command can run after the merge, and the owner can merge at any time.
    • A pause of more than 15 min fires ArgoCdAutoSyncDisabled (warning), and a claim kept with Prune=false fires ArgoCdApplicationOutOfSync after 15 min.
  5. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • kubernetes move PVC to another storage class change storage class tool, results: 5
    • kubectl plugin migrate persistent volume claim storage class, results: 5
    • Velero storage class mapping restore persistent volume claim rename, results: 5
    • pv-migrate copy data between two PVCs rsync kubernetes, results: 5
    • pv-migrate, results: 5
    • utkuozdemir pv-migrate github, results: 5
    • velero storage class mapping restore, results: 5
    • kubestr pvc migrate storage class, results: 5
    • change existing PVC storage class in place without deleting claim, results: 5
    • pv-migrate migrate to another storage class use case, results: 5

    Sources:

  6. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 27, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 27, 2026
  8. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-27 15:40 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/p2-mediumscope/k8ssource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions