How to backup and restore your container workloads using Kasten by Veeam
Tags: kubernetes, backup, kasten, policy
Published: 2021-05-25 23:31:58

---
title: How to backup and restore your container workloads using Kasten by Veeam
published: true
date: 2021-05-24 18:52:24 UTC
tags: Kubernetes,backup,Kasten,policy
canonical_url: https://veducate.co.uk/kasten-backup-restore/?utm_source=rss&utm_medium=rss&utm_campaign=kasten-backup-restore
---

This blog posts covers using Kasten by Veeam to create backup policies for data protection, and how to restore your data. This blog post follows on from the two installation guides;

- [Installing and configuring Kasten to protect container workloads on VMware Tanzu Kubernetes Grid](https://veducate.co.uk/kasten-tanzu)
- [How to install and configure Kasten to protect container workloads on Red Hat OpenShift and VMware vSphere](https://veducate.co.uk/kasten-install-configure-openshift)

###### Deploying a PacMan browser game as test application

To provide a demo mission critical application for this blog post, I’ve deployed PacMan into my OpenShift cluster, which is accessible via a web browser to play. You can find the files from [this GitHub repo](https://github.com/saintdle/pacman-tanzu)to deploy into your own environment.

[![pacman](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/02/pacman.png?resize=604%2C574&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/02/pacman.png?ssl=1)

This application uses MongoDB to store the scores from the games to give me persistent data stored on a PVC.

[![pacman high scores](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/02/pacman-high-scores.png?resize=604%2C193&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/02/pacman-high-scores.png?ssl=1)

You can see all of the PacMan resources below by running:

```
kubectl get all -n pacman
```

[![kubectl get all -n pacman](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/02/kubectl-get-all-n-pacman-.png?resize=604%2C203&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/02/kubectl-get-all-n-pacman-.png?ssl=1)

###### Creating a Policy to protect your deployment and data

Log into your Kasten Dashboard.

```
If you have not yet deployed and configured Kasten, please see these earlier blog posts.

- [Installing Kasten for Red Hat OpenShift](https://veducate.co.uk/kasten-install-configure-openshift)
- [Installing Kasten for VMware Tanzu Kubernetes](https://veducate.co.uk/kasten-tanzu)
```

On the Kasten dashboard, click the Policy tile (or new policy link within the tile).

[![Kasten Dashboard create policy](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-create-policy.png?resize=604%2C228&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-create-policy.png?ssl=1)

- On the Policies view, click Create New Policy, which will open up the new policy dialog on the right hand side of the screen.

[![Kasten Dashboard create new policy](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-create-new-policy.png?resize=604%2C361&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-create-new-policy.png?ssl=1)

I’m going to break down this view piece by piece. As depending on the options, the screen will cascade and show further options.

- First, set your policy name and comments As well as the action.

All data protection methods start with a Snapshot of the resources.

[![Kasten Dashboard new policy snapshot](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-new-policy-snapshot.png?resize=604%2C388&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-new-policy-snapshot.png?ssl=1)

- Next select the action frequency.

Clicking Advanced options will give you more granular control over the schedule. You can see here I am selecting to have two snapshots per hour during minute offsets within the hour.

The rest of the configuration here is your usual schedule settings.

[![Kasten Dashboard new policy snapshot action frequency](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-new-policy-snapshot-action-frequency.png?resize=604%2C533&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-new-policy-snapshot-action-frequency.png?ssl=1)

- Next up you have the Export Backups via Snapshot Exports settings

This is where you specify the configuration to turn your snapshot into a backup, and proper data protection in my opinion.

You can pick which snapshots are selected for export;

- 
  - 
    - Every Snapshot
    - Every Daily Snapshot
    - Every Weekly Snapshot
    - Every Monthly Snapshot
    - Every Yearly Snapshot
- Choose your Location profile you’ve created.

Set the Retention of your exported snapshots and what part of the snapshot data is exported. I.e the Snapshot data, or just a reference of the snapshot.

[![Kasten - new policy - Enable backups via Snapshot Exports](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-Enable-backups-via-Snapshot-Exports.png?resize=604%2C656&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-Enable-backups-via-Snapshot-Exports.png?ssl=1)

Clicking the Advanced Export Settings, you are presented with the below dialog box on the left hand side of your screen. You can exclude snapshots created by a particular Storage Class in your Kubernetes environment.

You can also choose to run blueprints or actions after an Export success or failure. I will not cover these advanced options in this blog post.

[![Kasten new policy Enable backups via Snapshot Exports Advanced export settings](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-Enable-backups-via-Snapshot-Exports-Advanced-export-settings.png?resize=441%2C421&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-Enable-backups-via-Snapshot-Exports-Advanced-export-settings.png?ssl=1)

- Moving on in the configuration next we need to identify our resources and data that make up our Applications.

You can select by Namespace, or by Labels.

[![Kasten - Create Policy - Select Applications](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/02/Kasten-Create-Police-Select-Applications-.png?resize=604%2C256&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/02/Kasten-Create-Police-Select-Applications-.png?ssl=1)

Once you’ve set this, we can then select the resources held under these two options. I will select all resources, which means my pod configuration, PVCs, Secrets and routes will be protected.

However if you select filter, you can choose to include or exclude based on filters.

[![Kasten new policy Select Applications Resource Filters](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-Select-Applications-Resource-Filters.png?resize=604%2C226&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-Select-Applications-Resource-Filters.png?ssl=1)

Set any advanced settings as needed.

[![Kasten new policy Advanced snapshot settings](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-Advanced-snapshot-settings.png?resize=604%2C365&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-Advanced-snapshot-settings.png?ssl=1)

You will be taken back to the policy screen with your newly created policy.

[![Kasten new policy policy created](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-policy-created.png?resize=604%2C686&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-new-policy-policy-created.png?ssl=1)

One of the items I’d like to call out before we move on any further is the option to view the YAML or Kubectl commands throughout the screens in Kasten. Here I am viewing the YAML for my policy, you can see the button for the YAML in the above screenshot.

[![kasten policy yaml](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/kasten-policy-yaml.png?resize=604%2C752&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/kasten-policy-yaml.png?ssl=1)

###### Running your policy

We can wait until the policy runs as per the schedule. Or we can run the policy manually by clicking the Run Once button on the policy (again see above).

You can see the confirmation to run the policy, and the notification message on screen.

[![kasten policy run now](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Policy-Run-Now.png?resize=604%2C343&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Policy-Run-Now.png?ssl=1)

Clicking “watch the dashboard” will show you the main dashboard with the activity screen as per the below.

[![Kasten Activity Dashboard](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Activity-Dashboard.png?resize=604%2C313&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Activity-Dashboard.png?ssl=1)

If you click the activities you will be given panel on the right hand side of the dashboard which provides more information.

Once the Export task has finished, if we look at the Azure account we have specified in the policy we can see data included within there from the export.

[![Kasten Azure Container with export data](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Azure-Container-with-export-data.png?resize=604%2C246&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Azure-Container-with-export-data.png?ssl=1)

If we look at the vCenter UI, we will see tasks for a snapshot of virtual object. This is because the vSphere CSI does not support snapshot, so Kasten does this by calling the vCenter APIs instead. This means you will not see the snapshots referenced in the vCenter UI under the Cloud Volumes view. However if you look at the files view of the datastore, you will see snapshot files.

![Kasten - Policy - vSphere Snapshot](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Policy-vSphere-Snapshot.png?resize=604%2C55) [![Kasten - Policy - vSphere Snapshot - Snapshot files](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Policy-vSphere-Snapshot-Snapshot-files.png?resize=604%2C194&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Policy-vSphere-Snapshot-Snapshot-files.png?ssl=1)

###### Viewing your protected data storage

On the dashboard, under the data tile, we now see this with some figures as we’ve run a backup and protected some data.

[![kasten dashboard data](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-Data.png?resize=604%2C218&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-Data.png?ssl=1)

Clicking the tile will give you more overview graphs of your protected data usage.

[![kasten dashboard data usage](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-Data-Usage.png?resize=604%2C756&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Dashboard-Data-Usage.png?ssl=1)

```
Note: When using a vSphere environment, the snapshot size will show the full VMDK Size, I.e 30GB as the VMDK is 30GB, if there is multiple snapshots, it will show as X the VMDK size. This makes the figure inflated. 

Kasten is aware of this, and is working on a fix.
```

###### Restoring your data

So the final piece is to restore your data. For this example, I’ve deleted the project called Pacman, which contains all the necessary components for running my application.

[![kubectl delete ns pacman](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/02/kubectl-delete-ns-pacman.png?resize=604%2C29&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/02/kubectl-delete-ns-pacman.png?ssl=1)

On the Kasten Dashboard, click the applications tile. Clicking one of the status will bring up your application list with a filter applied for that status.

[![kasten dashboard - applications](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/kasten-dashboard-applications.png?resize=604%2C219&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/kasten-dashboard-applications.png?ssl=1)

I have my single compliant application, which is where an active policy is running and protecting this project (namespace).

[![kasten dashboard - applications](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-applications-compliant-restore-application.png?resize=604%2C552&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-applications-compliant-restore-application.png?ssl=1)

```
Note: If you remove the full namespace, after some time, this will be synced by Kasten, and the protected data will move into the "removed" status. The data is still available to restore. See at the end of the blog how to view this data.
```

Select your restore point, you will also be notified where these are held. I will select one where the data has been exported to my Azure storage location.

[![Kasten - Applications - Restore Application - select restore point](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-Application-select-restore-point.png?resize=604%2C371&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-Application-select-restore-point.png?ssl=1)

The restore point pane will open on the right hand side of the screen. I will break this down into sections.

You have the ability here to delete the restore point as highlighted.

This restore point is also marked as been exported, with the explanation this will need to be brought down from your external location.

[![Kasten - Applications - Restore point](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point.png?resize=604%2C527&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point.png?ssl=1)

Select where you want to restore the application. I will recreate the pacman namespace.

The data only restore is not available, as this is a new namespace with no resources at all. The transform options are extremely powerful, allowing you to control how the resources and configuration is restored. For example, moving to a new namespace, edit your YAMLs to handle this. Using new secrets? Again edit your applications. Moving to a new cluster? This is how you control how your application handles this.

[![Kasten Applications Restore point Application Name Optional Restore Settings](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point-Application-Name-Optional-Restore-Settings.png?resize=604%2C601&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point-Application-Name-Optional-Restore-Settings.png?ssl=1)

Below is a quick example of a transform rule, changing the storageclass for a PVC, with the ability to test the code changes as well for additional validation.

[![Kasten Applications Restore point Transform](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point-Transform.png?resize=604%2C628&ssl=1)](https://i2.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point-Transform.png?ssl=1) [![Kasten Applications Restore point Test Transform](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point-Test-Transform.png?resize=604%2C359&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point-Test-Transform.png?ssl=1)

Review the rest of the resources for restore, you have the ability to un-select resources as needed.

[![Kasten - Applications - Restore point - Artifacts snapshot spec kanister](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point-Artifacts-snapshot-spec-kanister.png?resize=604%2C948&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-point-Artifacts-snapshot-spec-kanister.png?ssl=1)

Clicking to restore, you need to accept the confirmation, and then with the notification you can click to go back to the main dashboard.

[![Kasten - Applications - Restore confirm](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-confirm.png?resize=604%2C221&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-confirm.png?ssl=1) [![Kasten - Applications - Restore notification](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-notification.png?resize=604%2C79&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-notification.png?ssl=1)

We can see the restore activity in progress. Clicking on this activity will open up the restore pane on the right hand side of the screen.

[![Kasten - Applications - Restore activity dashboard](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-activity-dashboard.png?resize=604%2C245&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-activity-dashboard.png?ssl=1)

[![](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-activity-action-details.png?resize=442%2C1075&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Restore-activity-action-details.png?ssl=1)

And with that my Pacman application is available from the browser again, with my high score intact.

###### How do I see my applications when the namespace has been deleted?

When your namespace has been deleted, it will not fall under the compliant or non-compliant application status in Kasten, it moves to the “removed” status. You can view this by going to the Applications page and changing the status filter.

You will see below on the main dashboard, the applications tile only shows 55 applications instead of 56.

[![Kasten Application Tile pacman deleted](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Application-Tile-pacman-deleted.png?resize=446%2C377&ssl=1)](https://i1.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Application-Tile-pacman-deleted.png?ssl=1)

Click the tile, change the status as below to see your Application, which then allows you to restore the data.

[![Kasten Applications Removed](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Removed.png?resize=604%2C470&ssl=1)](https://i0.wp.com/veducate.co.uk/wp-content/uploads/2020/11/Kasten-Applications-Removed.png?ssl=1)

Regards

[Follow @Saintdle](https://twitter.com/saintdle)<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

[Dean Lewis](https://uk.linkedin.com/in/saintdle?trk=profile-badge)

 

The post [How to backup and restore your container workloads using Kasten by Veeam](https://veducate.co.uk/kasten-backup-restore/) appeared first on [vEducate.co.uk](https://veducate.co.uk).