惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
J
Java Code Geeks
S
SegmentFault 最新的问题
L
LangChain Blog
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
H
Help Net Security
阮一峰的网络日志
阮一峰的网络日志
Jina AI
Jina AI
N
Netflix TechBlog - Medium
A
About on SuperTechFans
博客园 - 叶小钗
美团技术团队
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Backup and Restore of a K3s Cluster Using Velero
giveitatry · 2026-04-24 · via DEV Community

This guide provides a practical, production-oriented walkthrough of installing, configuring, and troubleshooting Velero for backing up a K3s cluster. It focuses on reliability and reproducibility rather than theory.


1. Overview

Velero is an open-source tool designed to:

  • Back up Kubernetes resources (Deployments, Services, CRDs, etc.)
  • Optionally back up persistent volumes
  • Restore workloads to the same or a different cluster

In K3s environments, Velero is commonly used for:

  • Disaster recovery
  • Cluster migration
  • CI/CD environment replication

2. Installing Velero CLI on Linux

2.1 Download

You already identified the correct approach. Use:

curl -L https://github.com/velero-io/velero/releases/download/v1.18.0/velero-v1.18.0-linux-amd64.tar.gz | tar xz

Enter fullscreen mode Exit fullscreen mode

This downloads and extracts:

velero-v1.18.0-linux-amd64/

Enter fullscreen mode Exit fullscreen mode

2.2 Install binary system-wide

cd velero-v1.18.0-linux-amd64
sudo mv velero /usr/local/bin/

Enter fullscreen mode Exit fullscreen mode

2.3 Verify installation

velero version

Enter fullscreen mode Exit fullscreen mode

Expected output:

Client:
  Version: v1.18.0

Enter fullscreen mode Exit fullscreen mode

At this stage, the server part is not yet installed — that comes next.


3. Preparing Storage Backend

Velero requires object storage (S3-compatible).

Supported options:

  • AWS S3
  • MinIO (recommended for on-prem)
  • Hetzner Object Storage
  • Azure Blob / GCP

3.1 Create credentials file

Example:

cat <<EOF > credentials-velero
[default]
aws_access_key_id=<ACCESS_KEY>
aws_secret_access_key=<SECRET_KEY>
EOF

Enter fullscreen mode Exit fullscreen mode


4. Installing Velero in K3s

Velero runs inside the cluster as a controller.

4.1 Installation command

Example (S3-compatible storage):

velero install \
  --provider aws \
  --plugins velero/velero-plugin-for-aws:v1.8.0 \
  --bucket velero \
  --secret-file ./credentials-velero \
  --use-volume-snapshots=false \
  --backup-location-config \
    region=hel1,s3ForcePathStyle="true",s3Url=https://<OBJECT_STORAGE_ENDPOINT>:<PORT-IF-NEEDED>

Enter fullscreen mode Exit fullscreen mode

Key parameters explained

  • --provider aws
    Required even for S3-compatible systems

  • --plugins
    Enables S3 integration

  • --bucket
    Must already exist in storage

  • region=minio
    Required (even if not AWS) - any region will work

  • s3ForcePathStyle="true"
    Required for most non-AWS providers

  • s3Url
    Must be reachable from inside the cluster


4.2 Verify installation

kubectl get pods -n velero

Enter fullscreen mode Exit fullscreen mode

Expected:

velero-xxxxx   Running

Enter fullscreen mode Exit fullscreen mode


4.3 Validate storage

velero backup-location get

Enter fullscreen mode Exit fullscreen mode

Expected:

PHASE: Available

Enter fullscreen mode Exit fullscreen mode

This is the most important health indicator.


5. Creating Backups

5.1 Full cluster backup

velero backup create full-backup

Enter fullscreen mode Exit fullscreen mode

5.2 Check status

velero backup get

Enter fullscreen mode Exit fullscreen mode

Expected:

STATUS: Completed

Enter fullscreen mode Exit fullscreen mode

5.3 Detailed inspection

velero backup describe full-backup --details

Enter fullscreen mode Exit fullscreen mode


6. Restoring from Backup

velero restore create --from-backup full-backup

Enter fullscreen mode Exit fullscreen mode

This will:

  • recreate resources
  • restore metadata
  • optionally restore volumes (if configured)

7. Automating Backups

Example: daily backup at 02:00

velero schedule create daily-backup \
  --schedule="0 2 * * *"

Enter fullscreen mode Exit fullscreen mode


8. Persistent Volume Backups (Important)

By default (as in your setup):

--use-volume-snapshots=false

Enter fullscreen mode Exit fullscreen mode

This means:

  • Kubernetes objects are backed up
  • Persistent data is NOT

Options:

Option A — CSI snapshots (preferred)

Requires storage support

Option B — Node-agent (Restic)

--use-node-agent

Enter fullscreen mode Exit fullscreen mode

Without this, your backups are incomplete for stateful workloads.


9. Troubleshooting

9.1 CLI works but server not found

Error:

no matches for velero.io/v1

Enter fullscreen mode Exit fullscreen mode

Cause:

  • Velero not installed in cluster

Fix:

  • run velero install

9.2 Backup fails with FailedValidation

Common causes:

  • missing region
  • invalid storage config
  • bucket not reachable

Fix:
Ensure:

region: minio

Enter fullscreen mode Exit fullscreen mode


9.3 MissingRegion error

MissingRegion: could not find region configuration

Enter fullscreen mode Exit fullscreen mode

Fix:
Add:

region=minio

Enter fullscreen mode Exit fullscreen mode


9.4 Storage unavailable

BackupStorageLocation is in unavailable state

Enter fullscreen mode Exit fullscreen mode

Check:

velero backup-location get

Enter fullscreen mode Exit fullscreen mode

If not Available, verify:

  • endpoint URL (must be reachable from cluster)
  • credentials
  • bucket existence

9.5 Connection timeout

dial tcp ... i/o timeout

Enter fullscreen mode Exit fullscreen mode

Cause:

  • cluster cannot reach storage

Fix:

  • verify network access from pod:
kubectl run test --rm -it --image=busybox -- sh
wget -O- https://<endpoint>

Enter fullscreen mode Exit fullscreen mode


9.6 Incorrect protocol (HTTP vs HTTPS)

Many providers require HTTPS.

Incorrect:

http://...

Enter fullscreen mode Exit fullscreen mode

Correct:

https://...

Enter fullscreen mode Exit fullscreen mode


9.7 Plugin process exited (not an error)

plugin process exited

Enter fullscreen mode Exit fullscreen mode

This is normal behavior:

  • plugin runs per request
  • exits after execution

No action required.


9.8 Inconsistent logs (0/0/1 state)

available/unavailable/unknown: 0/0/1

Enter fullscreen mode Exit fullscreen mode

Occurs during startup.

Ignore if:

velero backup-location get

Enter fullscreen mode Exit fullscreen mode

shows:

Available

Enter fullscreen mode Exit fullscreen mode


10. Recovery Strategy for K3s

To restore a cluster on a new server:

  1. Install K3s
  2. Install Velero
  3. Configure same storage
  4. Run:
velero restore create --from-backup <backup-name>

Enter fullscreen mode Exit fullscreen mode

This reconstructs:

  • workloads
  • configs
  • namespaces

11. Best Practices

  • Always verify backups with test restores
  • Use external object storage (not same node)
  • Automate backups (schedules)
  • Enable volume backup for production workloads
  • Version control your Velero installation config