Velero Deep-Dive Skill
Deep analysis of Velero backups, schedules, restores, and disaster recovery configurations.
MANDATORY: Discovery-First Pattern
Always check Velero installation and storage locations before inspecting backups.
Phase 1: Discovery
#!/bin/bash
echo "=== Velero Deployment ==="
kubectl get deployment velero -n velero -o custom-columns='NAME:.metadata.name,READY:.status.readyReplicas,IMAGE:.spec.template.spec.containers[0].image' 2>/dev/null
echo ""
echo "=== Velero Pods ==="
kubectl get pods -n velero -o custom-columns='NAME:.metadata.name,STATUS:.status.phase,RESTARTS:.status.containerStatuses[0].restartCount' 2>/dev/null
echo ""
echo "=== Backup Storage Locations ==="
kubectl get backupstoragelocations -n velero -o custom-columns='NAME:.metadata.name,PROVIDER:.spec.provider,BUCKET:.spec.objectStorage.bucket,PHASE:.status.phase,LAST_VALIDATED:.status.lastValidationTime' 2>/dev/null
echo ""
echo "=== Volume Snapshot Locations ==="
kubectl get volumesnapshotlocations -n velero -o custom-columns='NAME:.metadata.name,PROVIDER:.spec.provider' 2>/dev/null
echo ""
echo "=== Backup Schedules ==="
kubectl get schedules -n velero -o custom-columns='NAME:.metadata.name,SCHEDULE:.spec.schedule,LAST_BACKUP:.status.lastBackup,PHASE:.status.phase' 2>/dev/null
echo ""
echo "=== Installed Plugins ==="
kubectl get deployment velero -n velero -o jsonpath='{range .spec.template.spec.initContainers[*]}{.image}{"\n"}{end}' 2>/dev/null
Phase 2: Analysis
#!/bin/bash
echo "=== Recent Backups ==="
kubectl get backups -n velero --sort-by=.metadata.creationTimestamp -o custom-columns='NAME:.metadata.name,STATUS:.status.phase,STARTED:.status.startTimestamp,COMPLETED:.status.completionTimestamp,EXPIRY:.status.expiration,ITEMS:.status.progress.totalItems' 2>/dev/null | tail -15
echo ""
echo "=== Failed Backups ==="
kubectl get backups -n velero -o json 2>/dev/null | jq -r '
.items[] |
select(.status.phase == "Failed" or .status.phase == "PartiallyFailed") |
"\(.metadata.name)\t\(.status.phase)\t\(.status.failureReason // "see logs")"
' | head -10
echo ""
echo "=== Restore Operations ==="
kubectl get restores -n velero -o custom-columns='NAME:.metadata.name,BACKUP:.spec.backupName,STATUS:.status.phase,STARTED:.status.startTimestamp,COMPLETED:.status.completionTimestamp' 2>/dev/null | head -10
echo ""
echo "=== Backup Details (latest per schedule) ==="
for schedule in $(kubectl get schedules -n velero -o jsonpath='{.items[*].metadata.name}' 2>/dev/null); do
kubectl get backups -n velero -l velero.io/schedule-name="$schedule" --sort-by=.metadata.creationTimestamp -o custom-columns='SCHEDULE:.metadata.labels.velero\.io/schedule-name,NAME:.metadata.name,STATUS:.status.phase,ITEMS:.status.progress.totalItems' 2>/dev/null | tail -2
done
echo ""
echo "=== Delete Backup Requests ==="
kubectl get deletebackuprequests -n velero -o custom-columns='NAME:.metadata.name,BACKUP:.spec.backupName,STATUS:.status.phase' 2>/dev/null | head -5
echo ""
echo "=== PV Backup Info ==="
kubectl get podvolumebackups -n velero -o custom-columns='NAME:.metadata.name,STATUS:.status.phase,VOLUME:.spec.volume,NODE:.spec.node' 2>/dev/null | head -10
echo ""
echo "=== Velero Logs (errors) ==="
kubectl logs deployment/velero -n velero --tail=20 2>/dev/null | grep -i "error\|fail\|warn" | head -10
Output Format
- Target ≤50 lines per output
- Use
-o custom-columns for CRD listings
- Show backup success/failure rates as aggregated summary
- List latest backup per schedule for quick health check
- Never dump full backup specs -- show status and item counts only
Anti-Hallucination Rules
- NEVER assume resource names — always discover via CLI/API in Phase 1 before referencing in Phase 2.
- NEVER fabricate metric names or dimensions — verify against the service documentation or
--help output.
- NEVER mix CLI commands between service versions — confirm which version/API you are targeting.
- ALWAYS use the discovery → verify → analyze chain — every resource referenced must have been discovered first.
- ALWAYS handle empty results gracefully — an empty response is valid data, not an error to retry.
Counter-Rationalizations
| Shortcut |
Counter |
Why |
| "I'll skip discovery and check known resources" |
Always run Phase 1 discovery first |
Resource names change, new resources appear — assumed names cause errors |
| "The user only asked for a quick check" |
Follow the full discovery → analysis flow |
Quick checks miss critical issues; structured analysis catches silent failures |
| "Default configuration is probably fine" |
Audit configuration explicitly |
Defaults often leave logging, security, and optimization features disabled |
| "Metrics aren't needed for this" |
Always check relevant metrics when available |
API/CLI responses show current state; metrics reveal trends and intermittent issues |
| "I don't have access to that" |
Try the command and report the actual error |
Assumed permission failures prevent useful investigation; actual errors are informative |
Common Pitfalls
- BSL validation: BackupStorageLocation must be Available -- Unavailable BSL blocks all backups
- Plugin compatibility: Velero plugins must match Velero version -- mismatched versions cause crashes
- PV snapshots vs file-copy: Volume snapshots are provider-specific; Restic/Kopia handles file-level backup
- Namespace exclusion: Default excludes
velero namespace -- check --exclude-namespaces in schedules
- TTL: Backups have TTL (default 30 days) -- expired backups are automatically deleted
- Partial failures: PartiallyFailed means some items failed -- check backup logs with
velero backup logs
- Restore hooks: Pre/post restore hooks can fail silently -- check restore logs for hook errors
- CSI snapshots: CSI snapshot support requires VolumeSnapshotClass and CSI plugin -- verify CSI driver compatibility
1---2name: managing-k8s-velero-deep3description: Use when working with K8S Velero Deep — velero deep-dive management for Kubernetes backup and disaster recovery. Covers backup schedules, backup status, restore operations, backup storage locations, volume snapshot locations, backup item actions, and plugin health. Use when auditing backup coverage, debugging backup failures, reviewing restore operations, or validating disaster recovery configurations.4---56# Velero Deep-Dive Skill78Deep analysis of Velero backups, schedules, restores, and disaster recovery configurations.910## MANDATORY: Discovery-First Pattern1112**Always check Velero installation and storage locations before inspecting backups.**1314### Phase 1: Discovery1516```bash17#!/bin/bash1819echo "=== Velero Deployment ==="20kubectl get deployment velero -n velero -o custom-columns='NAME:.metadata.name,READY:.status.readyReplicas,IMAGE:.spec.template.spec.containers[0].image' 2>/dev/null2122echo ""23echo "=== Velero Pods ==="24kubectl get pods -n velero -o custom-columns='NAME:.metadata.name,STATUS:.status.phase,RESTARTS:.status.containerStatuses[0].restartCount' 2>/dev/null2526echo ""27echo "=== Backup Storage Locations ==="28kubectl get backupstoragelocations -n velero -o custom-columns='NAME:.metadata.name,PROVIDER:.spec.provider,BUCKET:.spec.objectStorage.bucket,PHASE:.status.phase,LAST_VALIDATED:.status.lastValidationTime' 2>/dev/null2930echo ""31echo "=== Volume Snapshot Locations ==="32kubectl get volumesnapshotlocations -n velero -o custom-columns='NAME:.metadata.name,PROVIDER:.spec.provider' 2>/dev/null3334echo ""35echo "=== Backup Schedules ==="36kubectl get schedules -n velero -o custom-columns='NAME:.metadata.name,SCHEDULE:.spec.schedule,LAST_BACKUP:.status.lastBackup,PHASE:.status.phase' 2>/dev/null3738echo ""39echo "=== Installed Plugins ==="40kubectl get deployment velero -n velero -o jsonpath='{range .spec.template.spec.initContainers[*]}{.image}{"\n"}{end}' 2>/dev/null41```4243### Phase 2: Analysis4445```bash46#!/bin/bash4748echo "=== Recent Backups ==="49kubectl get backups -n velero --sort-by=.metadata.creationTimestamp -o custom-columns='NAME:.metadata.name,STATUS:.status.phase,STARTED:.status.startTimestamp,COMPLETED:.status.completionTimestamp,EXPIRY:.status.expiration,ITEMS:.status.progress.totalItems' 2>/dev/null | tail -155051echo ""52echo "=== Failed Backups ==="53kubectl get backups -n velero -o json 2>/dev/null | jq -r '54 .items[] |55 select(.status.phase == "Failed" or .status.phase == "PartiallyFailed") |56 "\(.metadata.name)\t\(.status.phase)\t\(.status.failureReason // "see logs")"57' | head -105859echo ""60echo "=== Restore Operations ==="61kubectl get restores -n velero -o custom-columns='NAME:.metadata.name,BACKUP:.spec.backupName,STATUS:.status.phase,STARTED:.status.startTimestamp,COMPLETED:.status.completionTimestamp' 2>/dev/null | head -106263echo ""64echo "=== Backup Details (latest per schedule) ==="65for schedule in $(kubectl get schedules -n velero -o jsonpath='{.items[*].metadata.name}' 2>/dev/null); do66 kubectl get backups -n velero -l velero.io/schedule-name="$schedule" --sort-by=.metadata.creationTimestamp -o custom-columns='SCHEDULE:.metadata.labels.velero\.io/schedule-name,NAME:.metadata.name,STATUS:.status.phase,ITEMS:.status.progress.totalItems' 2>/dev/null | tail -267done6869echo ""70echo "=== Delete Backup Requests ==="71kubectl get deletebackuprequests -n velero -o custom-columns='NAME:.metadata.name,BACKUP:.spec.backupName,STATUS:.status.phase' 2>/dev/null | head -57273echo ""74echo "=== PV Backup Info ==="75kubectl get podvolumebackups -n velero -o custom-columns='NAME:.metadata.name,STATUS:.status.phase,VOLUME:.spec.volume,NODE:.spec.node' 2>/dev/null | head -107677echo ""78echo "=== Velero Logs (errors) ==="79kubectl logs deployment/velero -n velero --tail=20 2>/dev/null | grep -i "error\|fail\|warn" | head -1080```8182## Output Format8384- Target ≤50 lines per output85- Use `-o custom-columns` for CRD listings86- Show backup success/failure rates as aggregated summary87- List latest backup per schedule for quick health check88- Never dump full backup specs -- show status and item counts only8990## Anti-Hallucination Rules91921. **NEVER assume resource names** — always discover via CLI/API in Phase 1 before referencing in Phase 2.932. **NEVER fabricate metric names or dimensions** — verify against the service documentation or `--help` output.943. **NEVER mix CLI commands between service versions** — confirm which version/API you are targeting.954. **ALWAYS use the discovery → verify → analyze chain** — every resource referenced must have been discovered first.965. **ALWAYS handle empty results gracefully** — an empty response is valid data, not an error to retry.9798## Counter-Rationalizations99100| Shortcut | Counter | Why |101|----------|---------|-----|102| "I'll skip discovery and check known resources" | Always run Phase 1 discovery first | Resource names change, new resources appear — assumed names cause errors |103| "The user only asked for a quick check" | Follow the full discovery → analysis flow | Quick checks miss critical issues; structured analysis catches silent failures |104| "Default configuration is probably fine" | Audit configuration explicitly | Defaults often leave logging, security, and optimization features disabled |105| "Metrics aren't needed for this" | Always check relevant metrics when available | API/CLI responses show current state; metrics reveal trends and intermittent issues |106| "I don't have access to that" | Try the command and report the actual error | Assumed permission failures prevent useful investigation; actual errors are informative |107108## Common Pitfalls109110- **BSL validation**: BackupStorageLocation must be Available -- Unavailable BSL blocks all backups111- **Plugin compatibility**: Velero plugins must match Velero version -- mismatched versions cause crashes112- **PV snapshots vs file-copy**: Volume snapshots are provider-specific; Restic/Kopia handles file-level backup113- **Namespace exclusion**: Default excludes `velero` namespace -- check `--exclude-namespaces` in schedules114- **TTL**: Backups have TTL (default 30 days) -- expired backups are automatically deleted115- **Partial failures**: PartiallyFailed means some items failed -- check backup logs with `velero backup logs`116- **Restore hooks**: Pre/post restore hooks can fail silently -- check restore logs for hook errors117- **CSI snapshots**: CSI snapshot support requires VolumeSnapshotClass and CSI plugin -- verify CSI driver compatibility