Usage of Velero with IBM Cloud Private (Power)

Prajyot Parab
IBM Cloud
Published in
5 min readMay 29, 2019

Overview

Velero (formerly Heptio Ark) gives you tools to back up and restore your Kubernetes cluster resources and persistent volumes.

From the Product Documentation:

Velero lets you:

  • Take backups of your cluster and restore in case of loss.
  • Copy cluster resources to other clusters.
  • Replicate your production environment for development and testing environments.

Velero consists of:

  • A server that runs on your cluster
  • A command-line client that runs locally

You can run Velero in clusters on a cloud provider or on-premises. For detailed information, see Compatible Storage Providers.

You can back up or restore all objects in your cluster, or you can filter objects by type, namespace, and/or label.

Velero is ideal for the disaster recovery use case, as well as for snapshotting your application state, prior to performing system operations on your cluster (e.g. upgrades).
For detailed information, see the Product Documentation.

Velero on Power (ppc64le)

Download Velero from here.

Velero Usage with IBM Cloud Private on Power

Environment

  • IBM Cloud Private 3.1.2/3.2.0 -Enterprise Edition (Cluster A)
  • IBM Cloud Private 3.1.2/3.2.0 -Enterprise Edition (Cluster B)
  • Kubernetes CLI ( kubectl v1.12.4 )
  • Velero v1.0.0+
  • Minio ( BackupStorageLocation )
  • Restic ( Fast, secure, efficient backup program )

Configuring Velero in Cluster ( A & B )

Refer the document to install Velero with Minio on IBM Cloud Private: Installing Velero on IBM Cloud Private

Use-Case 1

  • Demo:
Use-Case 1

Summary of the procedure:

  • Create sample namespace (eg. sample-app).
Create Namespace
  • Deploy a sample nodejs application from the IBM Cloud Private catalog in the sample-app namespace on cluster A.
Configure and Deploy nodejs application from IBM Cloud Private catalog
nodejs application deployment on cluster A
  • Create a backup of nodejs application with the following command:
Velero backup create nodejs-sample-backup-demo --selector app=nodejsSample
Create Backup
  • Restore nodejs application on cluster B with the following command:
Velero restore create --from-backup nodejs-sample-backup-demo
nodejs application restored on cluster B

Use-Case 2

  • Demo:
Use-Case 2

Summary of the procedure:

  • Delete the restored nodejs application from cluster B.
  • Deploy sample swift application from the IBM Cloud Private catalog in the sample-app namespace on cluster A.
Configure and Deploy swift application from IBM Cloud Private catalog
sample-app namespace with 2 deployments on cluster A
  • Create a backup of the entire sample-app namespace with the following command:
Velero backup create sample-app-backup-demo --include-namespaces sample-app
Create Backup
  • Restore it on cluster B with the following command:
Velero restore create --from-backup sample-app-backup-demo
sample-app namespace restored on cluster B

Use-Case 3

  • Demo :
Use-Case 3

Summary of the procedure:

  • Create a Persistent Volume with type local volume on cluster A.
{
"apiVersion": "v1",
"kind": "PersistentVolume",
"metadata": {
"name": "mongodb-sample-pv",
"resourceVersion": "",
"annotations": {
"pv.kubernetes.io/bound-by-controller": "yes"
},
"finalizers": [
"kubernetes.io/pv-protection"
]
},
"spec": {
"capacity": {
"storage": "50Mi"
},
"local": {
"path": "/var/lib/icp/Velero-mongodb-sample-pv"
},
"accessModes": [
"ReadWriteOnce"
],
"persistentVolumeReclaimPolicy": "Retain",
"storageClassName": "mongodb-sample-local-storage",
"nodeAffinity": {
"required": {
"nodeSelectorTerms": [
{
"matchExpressions": [
{
"key": "kubernetes.io/hostname",
"operator": "In",
"values": [
"cluster-A-IP",
"cluster-B-IP"
]
}
]
}
]
}
}
}
}
Image of Persistent Volume page
  • Create Persistent Volume Claim to bind to Persistent volume created in the previous step on cluster A.
{
"apiVersion": "v1",
"kind": "PersistentVolumeClaim",
"metadata": {
"name": "mongodb-sample-ibm-mongodb-dev-mongodb-pvc",
"namespace": "sample-app",
"resourceVersion": "",
"labels": {
"app": "mongodb-sample-ibm-mongodb-dev",
"chart": "ibm-mongodb-dev-1.1.3",
"heritage": "Tiller",
"release": "mongodb-sample"
},
"annotations": {
"pv.kubernetes.io/bind-completed": "yes"
},
"finalizers": [
"kubernetes.io/pvc-protection"
]
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "50Mi"
}
},
"volumeName": "mongodb-sample-pv",
"storageClassName": "mongodb-sample-local-storage",
"dataSource": null
}
}
Persistent Volume Claim
  • Deploy sample MongoDB application from the IBM Cloud Private catalog in the sample-app namespace on cluster A, configure it to use PVC created in the previous step.
Deploy MongoDB chart from the catalog
Configure PVC for MongoDB chart
Sample MongoDB application up and running
  • Annotate the pod associated with MongoDB application with the following command:
kubectl -n sample-test annotate pod/<POD_NAME> backup.Velero.io/backup-volumes=<BACKUP_NAME> --overwrite
Annotate Pod
  • Create a backup of the entire sample-app namespace with the following command:
Velero backup create mongodb-app-with-pv-demo --include-namespaces sample-test --snapshot-volumes
Create Backup
  • Restore it on cluster B with the following command:
Velero restore create --from-backup mongodb-app-with-pv-demo --restore-volumes
MongoDB application with PV restored on cluster B

Conclusion

Velero is suitable for managing disaster recovery, specifically for Kubernetes
cluster resources. It provides a simple, configurable, and operationally robust
way to back up your application state and associated data.
Velero also provides us with the ability to seamlessly migrate resources from one cluster to another using cloud or on-premise storage. Using restic plugin we can easily backup and restore persistent volumes, as well.
Velero worked on Power as expected and will serve as a critical tool while backing up and restoring workloads from a Kubernetes or IBM Cloud Private cluster hosted on Power.

--

--