Migrating Persistent Volumes Across Clusters
Move stateful data between clusters with snapshots, restores, or replication tools.
In plain words
PV migration is moving the sealed warehouse inventory and then registering its boxes in the destination warehouse's local catalog. The simple Kubernetes rule is: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
Think of it like…
PV migration is moving the sealed warehouse inventory and then registering its boxes in the destination warehouse's local catalog.
Where you’ve seen it
Before approving a data-path change, the storage owner runs velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM. Expected evidence: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover. If the run instead shows this symptom, stop and restore the last known state: CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable.
Words you’ll hear
- PV Migration
- For this lesson, PV Migration is the controlling idea: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
- Cross-Cluster
- Cross-Cluster is the checkpoint; run
velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUMand inspect the owner chain. CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable. - Replication
- Replication is the outcome to preserve; the cost is explicit: Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan.
- Verification evidence
- The evidence command is
velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM. It connects the declaration to this behavior: Move stateful data between clusters with snapshots, restores, or replication tools.
Visual diagram
Theory & deep dive
How PV Migration reaches the intended state
Move stateful data between clusters with snapshots, restores, or replication tools. PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
The concrete checkpoint is velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM; compare the PV Migration owner, Cross-Cluster state, and Replication outcome instead of treating YAML acceptance as proof.
Run velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM after the change and correlate the result with Events and the owning object. PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
Cross-Cluster: failure boundary and production cost
CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable. The prerequisite contract is concrete: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan. A safe design limits blast radius, records the last good configuration, and uses velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM as a deterministic rollback checkpoint.
Capture the current state with velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable.
How it works, step by step
Step 1 of 41. Declare the data contract
State capacity, topology, access, and ownership in the claim or class: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
- Goal
- Move stateful data between clusters with snapshots, restores, or replication tools.
- Owner
- PV Migration
When to use it & trade-offs
What it is
Move stateful data between clusters with snapshots, restores, or replication tools. PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
Why it matters: CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable. The invariant at risk is specific: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover. The quickest fact check before changing the design is velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM.
When to reach for it
- Use PV Migration to enforce this invariant: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
- Use Cross-Cluster evidence from
velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUMin reviews and incident timelines. Move stateful data between clusters with snapshots, restores, or replication tools. - Choose the managed external data plane route only when this cost is justified by governance or scale: Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan.
When to avoid or be careful
- Avoid assuming PV Migration is complete after YAML submission; the required behavior is concrete: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
- Avoid treating the next symptom as random; check the owner and state with
velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUMfirst: CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable. - Avoid adopting a heavier platform wrapper before measuring its cost: Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan.
Native, manual, and managed paths for PV Migration
velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM.Strengths: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
Watch out: Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan. Recovery must also recognize this signal: CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable.
velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM; the expected invariant is: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.Strengths: velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM gives immediate feedback without first building a platform layer.
Watch out: A manual change can hide drift, and unlike PV Migration, it does not make this symptom self-documenting: CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable.
velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM.Strengths: Platform controls can wrap this exact behavior in policy or dashboards: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
Watch out: The added platform ownership buys value at this cost: Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan.
Interview signals & numbers to know
When this topic comes up
- Interview anchor: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
- Trace PV Migration to Replication through Cross-Cluster; the invariant is: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
- Recognize the symptom: CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable.
- Justify the cost: Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan.
- Verify with velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM instead of only inspecting YAML.
Benchmarks & rules of thumb
- 2
- clusters must be coordinated: source and destination
- 3
- cutover gates: consistent copy, checksum, and application health
- 0
- assumption that a source StorageClass exists at the destination
Common mistakes & follow-ups
Common interview mistakes
- Debugging only the child object misses the PV Migration owner contract: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover.
- Ignoring this telltale condition leads to unrelated changes: CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable.
- Repeating
velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUMwithout an owner for remediation wastes retry cost. Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan.
Likely interviewer follow-ups
- How would API output and runtime evidence prove this behavior: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover?
- Which owner object, logs, and Events would you inspect for this symptom-CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable-?
- At what threshold would this cost become unacceptable: Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan?
velero backup create migrate; kubectl get volumesnapshot,pvc; kubectl exec restore-job -- test -f /data/CHECKSUM, name the failure, then justify the cost. Invariant: PV migration moves an application-consistent snapshot, storage replication stream, or file-level copy and recreates claims under target classes and topology before endpoint cutover. Failure: CSI snapshots are usually not portable across providers or regions, and copying bytes without checking encryption keys, filesystem UUIDs, and database write order can make a clean restore unusable. Cost: Replication minimizes downtime but adds cost and complexity; offline copy is simpler but freezes service and requires a tested reverse plan.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Migrating Persistent Volumes Across Clusters with generative AI interview Q&A and hands-on practice.