Modern businesses increasingly adopt microservice architecture using Kubernetes to manage containerized applications. However, as complexity grows, so does the need for a reliable backup system—not only for configurations but also for persistent data. This becomes especially important when the Kubernetes cluster is deployed on a VPS, where the administrator is fully responsible for infrastructure protection.
In this article, we’ll walk you through how to implement an automated backup system for a Kubernetes cluster on a VPS using modern tools like Velero, Restic, and S3-compatible storage. We’ll also look at how to restore configurations and data in case of failure.
Why Kubernetes Backup Is Essential
- Unexpected failures: Even a reliable VPS can fail due to disk corruption, human error, or cyberattacks.
- Cluster complexity: Rebuilding a cluster from scratch is time-consuming. Losing configurations, CRDs, and PVCs can halt business operations.
- Portability: Automated backups simplify migration between hosting platforms and help restore infrastructure quickly.
What Needs to Be Backed Up in Kubernetes
Unlike conventional systems, Kubernetes requires backup of two critical layers:
- Kubernetes resources (configurations) — Deployment, Service, ConfigMap, Secret, and so on.
- Persistent data inside Volumes (PVC) — such as databases or files stored in pods.
Both must be backed up in sync and ready for recovery.
Key Tools for Backup
Velero
Velero is a powerful open-source tool for backup, recovery, and migration of Kubernetes clusters. It supports both cloud and on-premises environments, including VPS setups.
Features:
- Backup of Kubernetes resource objects.
- PVC backup with Restic integration.
- Automated scheduling support.
- S3-compatible storage support (MinIO, Wasabi, AWS S3, etc.).
Restic
Restic is a secure and simple CLI tool for file backups. Velero uses it to back up PVC contents independently of volume types.
How to Set Up Kubernetes Backup on VPS
1. Environment Setup
- A VPS with a running Kubernetes cluster (e.g., via kubeadm).
- Access to the cluster via kubectl.
- An account on S3-compatible storage or local MinIO configured.
You can use dedicated server hosting or VPS services to deploy your own Kubernetes cluster with full control.
2. Installing Velero
bash
velero install \
--provider aws \
--plugins velero/velero-plugin-for-aws:v1.7.0 \
--bucket my-k8s-backups \
--secret-file ./credentials-velero \
--backup-location-config region=us-east-1,s3ForcePathStyle=true,s3Url=https://minio.myhost.local
- –provider: “aws” is used even for MinIO.
- –secret-file: authentication credentials for the storage.
- –s3Url: URL for MinIO or other S3-compatible services.
3. Enabling PVC Backup with Restic
bash
velero install --use-restic ...
Important: all PVCs must be annotated with backup.velero.io/backup-volumes.
4. Manual Backup Creation
bash
velero backup create cluster-backup --include-namespaces my-namespace
Or for a full-cluster backup:
bash
velero backup create full-backup --ttl 168h
5. Scheduling Automatic Backups
bash
velero schedule create daily-backup --schedule="0 2 * * *" --ttl 720h0m0s
This creates a backup daily at 2:00 AM that is stored for 30 day
Restoring from a Backup
To restore the cluster state:
bash
velero restore create --from-backup full-backup
If PVCs were used, Restic will automatically handle volume data recovery via VolumeMount.
If you’re using server colocation, this setup allows for fully independent, automated backups even on custom infrastructure.
Security Best Practices
- Regularly verify the integrity and usability of backups.
- Separate access to the storage—use different keys for backup and recovery.
- Avoid storing Kubernetes secrets in plain text—encrypt them or use sealed-secrets.
Alternatives to Velero
- Kasten K10 — a paid enterprise solution from Veeam.
- Stash by AppsCode — an operator-based solution using VolumeSnapshot and custom backup controllers.
- Custom scripts + Restic — a lightweight approach for small-scale clusters with manual management.
Conclusion
Backing up a Kubernetes cluster is a necessity, not an option. With Velero and Restic, you can reliably automate backups even in VPS or dedicated server environments. You get automation, encryption, fast recovery—and peace of mind.
Use Server.ua infrastructure solutions to ensure availability, business continuity, and full control over your Kubernetes environment—whether you’re running a small startup or a large enterprise.
Ready to secure your Kubernetes cluster? Choose a VPS server or dedicated server plan with flexible configurations, perfect for backup and Kubernetes management.
Leave a Reply