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: |4 Use when working with K8S Velero Deep — velero deep-dive management for5 Kubernetes backup and disaster recovery. Covers backup schedules, backup6 status, restore operations, backup storage locations, volume snapshot7 locations, backup item actions, and plugin health. Use when auditing backup8 coverage, debugging backup failures, reviewing restore operations, or9 validating disaster recovery configurations.10connection_type: k8s11preload: false12metadata:13 source: https://skillmd.com/skills/cloudthinker-ai/managing-k8s-velero-deep14---1516# Velero Deep-Dive Skill1718Deep analysis of Velero backups, schedules, restores, and disaster recovery configurations.1920## MANDATORY: Discovery-First Pattern2122**Always check Velero installation and storage locations before inspecting backups.**2324### Phase 1: Discovery2526```bash27#!/bin/bash2829echo "=== Velero Deployment ==="30kubectl get deployment velero -n velero -o custom-columns='NAME:.metadata.name,READY:.status.readyReplicas,IMAGE:.spec.template.spec.containers[0].image' 2>/dev/null3132echo ""33echo "=== Velero Pods ==="34kubectl get pods -n velero -o custom-columns='NAME:.metadata.name,STATUS:.status.phase,RESTARTS:.status.containerStatuses[0].restartCount' 2>/dev/null3536echo ""37echo "=== Backup Storage Locations ==="38kubectl 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/null3940echo ""41echo "=== Volume Snapshot Locations ==="42kubectl get volumesnapshotlocations -n velero -o custom-columns='NAME:.metadata.name,PROVIDER:.spec.provider' 2>/dev/null4344echo ""45echo "=== Backup Schedules ==="46kubectl get schedules -n velero -o custom-columns='NAME:.metadata.name,SCHEDULE:.spec.schedule,LAST_BACKUP:.status.lastBackup,PHASE:.status.phase' 2>/dev/null4748echo ""49echo "=== Installed Plugins ==="50kubectl get deployment velero -n velero -o jsonpath='{range .spec.template.spec.initContainers[*]}{.image}{"\n"}{end}' 2>/dev/null51```5253### Phase 2: Analysis5455```bash56#!/bin/bash5758echo "=== Recent Backups ==="59kubectl 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 -156061echo ""62echo "=== Failed Backups ==="63kubectl get backups -n velero -o json 2>/dev/null | jq -r '64 .items[] |65 select(.status.phase == "Failed" or .status.phase == "PartiallyFailed") |66 "\(.metadata.name)\t\(.status.phase)\t\(.status.failureReason // "see logs")"67' | head -106869echo ""70echo "=== Restore Operations ==="71kubectl 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 -107273echo ""74echo "=== Backup Details (latest per schedule) ==="75for schedule in $(kubectl get schedules -n velero -o jsonpath='{.items[*].metadata.name}' 2>/dev/null); do76 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 -277done7879echo ""80echo "=== Delete Backup Requests ==="81kubectl get deletebackuprequests -n velero -o custom-columns='NAME:.metadata.name,BACKUP:.spec.backupName,STATUS:.status.phase' 2>/dev/null | head -58283echo ""84echo "=== PV Backup Info ==="85kubectl get podvolumebackups -n velero -o custom-columns='NAME:.metadata.name,STATUS:.status.phase,VOLUME:.spec.volume,NODE:.spec.node' 2>/dev/null | head -108687echo ""88echo "=== Velero Logs (errors) ==="89kubectl logs deployment/velero -n velero --tail=20 2>/dev/null | grep -i "error\|fail\|warn" | head -1090```9192## Output Format9394- Target ≤50 lines per output95- Use `-o custom-columns` for CRD listings96- Show backup success/failure rates as aggregated summary97- List latest backup per schedule for quick health check98- Never dump full backup specs -- show status and item counts only99100## Anti-Hallucination Rules1011021. **NEVER assume resource names** — always discover via CLI/API in Phase 1 before referencing in Phase 2.1032. **NEVER fabricate metric names or dimensions** — verify against the service documentation or `--help` output.1043. **NEVER mix CLI commands between service versions** — confirm which version/API you are targeting.1054. **ALWAYS use the discovery → verify → analyze chain** — every resource referenced must have been discovered first.1065. **ALWAYS handle empty results gracefully** — an empty response is valid data, not an error to retry.107108## Counter-Rationalizations109110| Shortcut | Counter | Why |111|----------|---------|-----|112| "I'll skip discovery and check known resources" | Always run Phase 1 discovery first | Resource names change, new resources appear — assumed names cause errors |113| "The user only asked for a quick check" | Follow the full discovery → analysis flow | Quick checks miss critical issues; structured analysis catches silent failures |114| "Default configuration is probably fine" | Audit configuration explicitly | Defaults often leave logging, security, and optimization features disabled |115| "Metrics aren't needed for this" | Always check relevant metrics when available | API/CLI responses show current state; metrics reveal trends and intermittent issues |116| "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 |117118## Common Pitfalls119120- **BSL validation**: BackupStorageLocation must be Available -- Unavailable BSL blocks all backups121- **Plugin compatibility**: Velero plugins must match Velero version -- mismatched versions cause crashes122- **PV snapshots vs file-copy**: Volume snapshots are provider-specific; Restic/Kopia handles file-level backup123- **Namespace exclusion**: Default excludes `velero` namespace -- check `--exclude-namespaces` in schedules124- **TTL**: Backups have TTL (default 30 days) -- expired backups are automatically deleted125- **Partial failures**: PartiallyFailed means some items failed -- check backup logs with `velero backup logs`126- **Restore hooks**: Pre/post restore hooks can fail silently -- check restore logs for hook errors127- **CSI snapshots**: CSI snapshot support requires VolumeSnapshotClass and CSI plugin -- verify CSI driver compatibility