How to Use Kasten for Kubernetes Backup, Recovery and Cross-Cluster Migration
Kasten for Kubernetes Backup, Recovery and Cross-Cluster Migration
Source:
https://play.instruqt.com/kasten/tracks/kasten-quick-start-kubernetes-book
https://docs.kasten.io/latest/install/aws/aws.html
https://www.youtube.com/watch?v=xyLWU7Q7nso
(storage type beda misal harus “gp2”)
https://blog.kubernauts.io/backup-and-restore-using-kastens-k10-platform-and-openebs-e706676d3d65
Installation
Getting Started
- Add the Kasten Helm 10 repository
helm repo add kasten https://charts.kasten.io/
- Installing K10
for this example, I will give example to install Kasten on the cloud provider AWS. you also can use other cloud providers.
kubectl create namespace kasten-iohelm install k10 kasten/k10 — namespace=kasten-io \- set secrets.awsAccessKeyId=”Your_KeyID” \- set secrets.awsSecretAccessKey=”Your_Secret_access_Key”
or
using Other Kubernetes Distributions like HUAWEI, where you must set the storage class at Kasten Installation.
kubectl create namespace kasten-iohelm install k10 kasten/k10 — namespace=kasten-io \- set global.persistence.storageClass=csi-disk
> Output:
NAME: k10
LAST DEPLOYED: Mon Oct 25 13:45:10 2021
NAMESPACE: kasten-io
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Thank you for installing Kasten’s K10 Data Management Platform!
If You get this Error :
default-scheduler 0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
It means you do not use a common cloud provider that already registered on Kasten (AWS, Azure, OpenShift, Google Cloud, and DigitalOcean). So you need to set “global.persistence.storageClass” like on HUAWEI.
- Accest via Port-Forward
kubectl — namespace kasten-io port-forward service/gateway 8080:8000
use this to open: http://127.0.0.1:8080/k10/#/
- Namespace Terminate
If want you terminate namespace kasten-io but stuck at namespcace status Terminated and not being delete properly by Kubernets.
kubectl get namespace “kasten-io” -o json \| tr -d “\n” | sed “s/\”finalizers\”: \[[^]]\+\]/\”finalizers\”: []/” \| kubectl replace — raw /api/v1/namespaces/kasten-io/finalize -f -
- Backup Application or namespace in Kubernetes using Kasten
Policies → Create Policies
Action: Snapshot
Select Applications: By Name
Location Profile for Kanister Actions: S3-storage-AWS (You need to create Location profile first )
- Migrate
- Step 1 (on your Source Cluster)
Applications → (Choose Application) → Export → (Choose restore point) → Export → save “export-key”
2. Step 2 (Destination Cluster)
Policies → Create Policies
Action: Import
Config Data for Import: (paste “export-key”)
* HELP !!!
A. Jika artifact sudah ada “No action was taken because the import artifacts already existed”
(on your Source Cluster)
1. Export baru
2. simpan “export-key”
(Destination Cluster)
3. Ganti “export-key” dengan yang baru dan jalankan Import
B. Patch atau anonnate skript yaml
1. Open Import or Restore
2. “Checkmark” [✓]
- [Restore] Apply transforms to restored resources
- [Import] Restore After Import → Apply transforms to restored resources
3. Add New Transform
4. Write custom “Display Name”
5. Resource [deployment/secret/service/etc.)
6. Operations → New Operation → (Replace/add)
7. Example