Velero Backup & Restore for Kubernetes Prompt
Design Velero backup strategy — schedules, restore, namespace migration, cross-cluster DR, snapshot integration.
- Target user
- Platform engineers managing Kubernetes backups
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior Kubernetes platform engineer who has used Velero for production backup, restore, and namespace migration across clusters. I will provide: - The use case (DR, namespace migration, periodic backup) - Current Velero setup (object store, snapshotter) - Symptom (backup failing, restore stuck, can't migrate) Your job: 1. **Velero components**: - **Server** — controller in cluster - **Object store** — S3/GCS/Azure for backups - **Snapshotter** — CSI snapshots or cloud-volume snapshots - **CLI** — `velero` for management 2. **For backup**: - `velero backup create` — point-in-time - Scoped by namespaces, labels, resources - Includes object manifests + optional volume data 3. **For restore**: - `velero restore create --from-backup` - Can rename namespaces, exclude resources - Volumes: from snapshot OR file copy 4. **For schedules**: - `velero schedule create` for periodic - TTL on backups - Cron-style timing 5. **For volume backup methods**: - **CSI snapshots** — fast, recommended - **Restic / Kopia** — file-system level, slower but works anywhere - **Cloud snapshots** — provider-native 6. **For namespace migration**: - Backup from source cluster - Restore to destination (different name OK) - Useful for cluster upgrades, region migrations 7. **For DR**: - Cross-region object store replication - Periodic backups - Restore drill quarterly 8. **For Velero failures**: - `velero backup describe <name>` for status - `velero backup logs <name>` for detail Mark DESTRUCTIVE: restoring over existing namespace (overwrites), backup with TTL too short (lost), enabling restore of cluster-scoped resources that conflict. --- Use case: [DESCRIBE] Velero setup: [DESCRIBE — object store, snapshotter] Symptom: [DESCRIBE]
Why this prompt works
Velero is the standard K8s backup tool but its model has subtleties. This prompt walks them.
How to use it
- Pick volume backup method based on infra.
- Schedule with appropriate retention.
- Test restores regularly.
- For DR, replicate object store.
Useful commands
# Install (Helm)
helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts
helm install velero vmware-tanzu/velero \
--namespace velero --create-namespace \
--set configuration.backupStorageLocation[0].provider=aws \
--set configuration.backupStorageLocation[0].bucket=my-velero-backups \
--set configuration.backupStorageLocation[0].config.region=us-east-1 \
--set configuration.volumeSnapshotLocation[0].provider=aws \
--set configuration.volumeSnapshotLocation[0].config.region=us-east-1 \
--set initContainers[0].name=velero-plugin-for-aws \
--set initContainers[0].image=velero/velero-plugin-for-aws:v1.10.0 \
--set initContainers[0].volumeMounts[0].mountPath=/target \
--set initContainers[0].volumeMounts[0].name=plugins
# Status
velero version
velero backup get
velero schedule get
velero restore get
# Create backup
velero backup create web-prod-$(date +%F) \
--include-namespaces=production \
--include-cluster-resources=true \
--snapshot-volumes=true \
--ttl 720h
# Schedule
velero schedule create daily \
--schedule="0 2 * * *" \
--include-namespaces=production \
--ttl 720h
# Restore
velero restore create --from-backup web-prod-2026-05-30
# Restore to different namespace
velero restore create \
--from-backup web-prod-2026-05-30 \
--namespace-mappings production:production-restored
# Inspect
velero backup describe <name> --details
velero backup logs <name>
velero restore describe <name>
Patterns
Daily backup with retention
apiVersion: velero.io/v1
kind: Schedule
metadata:
name: daily-prod
namespace: velero
spec:
schedule: "0 2 * * *"
template:
includedNamespaces: [production]
snapshotVolumes: true
ttl: 720h0m0s # 30 days
storageLocation: default
Cross-cluster migration
# In source cluster
velero backup create migration-2026-05-30 --include-namespaces=team-a --include-cluster-resources=false
# In destination cluster (configured with same object store)
velero restore create --from-backup migration-2026-05-30
DR drill
# Quarterly: restore latest backup to a "DR test" namespace
velero restore create dr-drill-$(date +%F) \
--from-backup $(velero backup get -o json | jq -r '.items[0].metadata.name') \
--namespace-mappings production:dr-test \
--restore-volumes=true
# Verify app works in dr-test, then delete
Common findings this catches
- Backup failing → object store access; check IAM.
- Restore fails for volumes → snapshot class missing in target.
- Schedule not creating backups → schedule paused; check status.
- Old backups consuming object store → tune TTL.
- PVC restore creates new with different name — by design; update references.
- Restore overwriting in-use namespace — use namespace mapping.
- Untested DR plan — schedule drills.
When to escalate
- Major restore during incident — coordinated.
- Cross-region DR architecture — strategic.
- Backup tool migration — staged.
Related prompts
-
Cinder Backup & Restore Workflow Prompt
Design and operate Cinder backup workflows — backend choice (Ceph/Swift/NFS), incremental backups, cross-AZ restore, retention.
-
Kubernetes etcd Health, Backup & Restore Prompt
Operate the etcd backing store — health checks, snapshot backup, defragmentation, leader election issues, restore from snapshot.
-
Kubernetes VolumeSnapshot & CSI Snapshot Prompt
Use CSI volume snapshots — VolumeSnapshotClass, VolumeSnapshot, restore from snapshot, snapshotter sidecar issues.