Performing backups manually
Use the Velero tool to manually create backups of cluster data and restore them.
- Create a Kubernetes cluster of the latest version, if not done so already.
Place one or more worker node groups in the
ME1availability zone. Choose the other cluster parameters at your own discretion. - Make sure that you can connect to the cluster using
kubectl. - Install and configure Velero, if you have not done it already.
- Install the OpenStack CLI, if you have not done it already. Make sure you can authorize in the cloud with it.
To get familiar with creating a backup and restoring from it, create the coffee demo application. A persistent volume will be attached to this application.
-
Create a manifest file specifying the storage class in the availability zone where your worker node group is located:
-
Apply the manifest in the cluster:
kubectl apply -f coffee.yamlThe manifest will create all the Kubernetes resources needed for the application to work in the
example-appnamespace. -
Make sure a disk has been created for the persistent volume:
-
Find the persistent volume created for the application:
kubectl get pv -n example-appIn the output, find the ID of the persistent volume whose
CLAIMcolumn showsexample-app/coffee-pvc. Example command output:NAME ... STATUS CLAIM ...... ... ... ... ...<PERSISTENT_VOLUME_ID> ... Bound example-app/coffee-pvc ... -
Get the ID of the disk for the created persistent volume:
kubectl describe pv <PERSISTENT_VOLUME_ID> -n example-appThe command output will contain the disk ID in the
VolumeHandleparameter. Example output:...Source:Type: CSI (a Container Storage Interface (CSI) volume source)Driver: cinder.csi.openstack.orgFSType: ...VolumeHandle: <DISK_ID>... -
Get detailed information about the disk with this ID using the OpenStack CLI:
openstack volume show <DISK_ID> --fit-width
-
-
Wait until the load balancer is assigned a floating IP address.
Periodically check the load balancer status:
kubectl get svc -n example-appThe floating IP address assigned to the load balancer should appear in the
EXTERNAL-IPcolumn. -
Make sure NGINX responds to requests:
curl <FLOATING_IP_ADDRESS_OF_LOAD_BALANCER>Expected output:
The coffee pod says Hello World to everyone! This file is located on the dynamically claimed Cinder ReadWriteOnce persistent volume.
-
Create a manual backup of the entire
example-appnamespace, which contains the resources needed for the application to work:velero backup create coffee-backup --include-namespaces example-app -
Get detailed information about the backup:
velero backup describe coffee-backup -
(Optional) View the logs of the backup operation:
velero backup logs coffee-backup -
(Optional) Configure a schedule for automatic backup creation.
-
Simulate an application failure. To do this, delete the
example-appnamespace, which contains the resources needed for the application to work:kubectl delete ns example-app -
Restore the resources from the backup that was created earlier:
velero restore create --from-backup coffee-backupThe data will be restored in the same cluster where the backup was performed. If you need to restore the data to a new cluster:
- Create a cluster.
- Install Velero in the cluster.
- Run the command above.
-
Wait until the load balancer is assigned a floating IP address.
Periodically check the load balancer status:
kubectl get svc -n example-appThe floating IP address assigned to the load balancer should appear in the
EXTERNAL-IPcolumn. -
Make sure NGINX responds to requests:
curl <FLOATING_IP_ADDRESS_OF_LOAD_BALANCER>Expected output:
The coffee pod says Hello World to everyone! This file is located on the dynamically claimed Cinder ReadWriteOnce persistent volume.
A running cluster is billed and consumes computing resources. If you no longer need the Velero tool and the Kubernetes resources created to test backups, delete them:
-
Delete the created
example-appnamespace and its associated resources, as well as the created backup:Linux/macOSWindowskubectl delete ns example-appvelero backup delete coffee-backup -
Delete Velero:
velero uninstall -
Delete the backups from the bucket that was used by Velero.
If necessary, also delete the bucket itself.
-
Stop the cluster you created to use it later or delete it permanently.