# Management Console

To get started with Trilio via the management console in your environment, the following steps must be performed:

## Prerequisites <a href="#install-test-csi-driver" id="install-test-csi-driver"></a>

1. Authenticate access to the Management Console (UI). Refer to[UI Authentication](/kubernetes/4.0.x/advanced-configuration/management-console/ui-authentication-intro.md).
2. Configure access to the Management Console (UI). Refer to[Configuring the UI](/kubernetes/4.0.x/advanced-configuration/management-console/accessing-the-ui.md).

## Steps Overview

1. Install a compatible CSI Driver
2. Create a Backup Target - A location where backups will be stored.
3. Create a retention policy (Optional) - To specify how long to keep the backups for.
4. Run Example:
   * Label Example
   * Helm Example
   * Operator Example
   * Virtual Machine Example
   * Namespace Example

## Step 1: Install a CSI Driver

{% hint style="info" %}
Skip this step if your environment already has a CSI driver installed with snapshot capability.
{% endhint %}

Trilio for Kubernetes requires a compatible Container Storage Interface (CSI) driver that provides the **Snapshot** feature.

You should check the [Kubernetes CSI Developer Documentation](https://kubernetes-csi.github.io/docs/drivers.html) to select a driver appropriate for your backend storage solution. See the selected CSI driver's documentation for details on the installation of the driver in your cluster.

## Step 2: Create a Target <a href="#create-a-target" id="create-a-target"></a>

Create a secret containing the credentials for data stores to store backups. An example is provided below:

```
apiVersion: v1
kind: Secret
metadata:
  name: sample-secret
type: Opaque
stringData:
  accessKey: AKIAS5B35DGFSTY7T55D
  secretKey: xWBupfGvkgkhaH8ansJU1wRhFoGoWFPmhXD6/vVD
```

You can either create the secret using the above YAML definition or use the management console to create it as part of the workflow for creating the backup target.

![Create secret while creating AWS S3 target](/files/KAvHq2tjkAbDlnOFT6Ws)

Please use one of the [Target examples](/kubernetes/4.0.x/getting-started/using-trilio/getting-started-1/triliovault-crds.md#backup-target) provided in the Custom Resource Definition section as a template for creating an NFS, Amazon S3, or any S3-compatible storage target.

Supported values for S3 vendors include:

```
"AWS", "RedhatCeph", "Ceph", "IBMCleversafe", "Cloudian", "Scality", "NetApp", "Cohesity", "SwiftStack", "Wassabi", "MinIO", "DellEMC", "Other"
```

An Amazon S3 target example is provided below:

![Create demo-s3-target on AWS using above created secret](/files/sw7q7PyxJxnpoNQeUI2P)

![demo-s3-target created](/files/uaPY8YjyHAVrClJdSUKo)

**Note**: With the above configuration, the target would get created in the current user namespace unless specified. Also, additional information on Bucket permissions can be found here: [AWS S3 Target Permissions](/kubernetes/4.0.x/advanced-configuration/aws-s3-target-permissions.md)

## Step 3: Create a Retention Policy (Optional)

While the example backup custom resources created by following this Getting Started page can be deleted manually via `kubectl` commands, Trilio also provides backup retention capability - to automatically delete the backups based on defined time boundaries.

![Create demo-retention-policy](/files/AUYPoZiUjdtRas2p2gTK)

![Retention policy created successfully](/files/Z0V9sS8FIsr58GuGxQ06)

A retention policy is referenced in the [backupPlan CR](/kubernetes/4.0.x/getting-started/using-trilio/getting-started-1/triliovault-crds.md#backupplan).

Note: With the above configuration, the policy would get created in the default namespace unless specified.

## Step 4: Run Example

The following section will cover creating a sample application and backup/restore of it via labels, Helm, Operator, or a namespace-based backup.

More details about CRDs and their usage/explanation can be found in the [Custom Resource Definition Section](/kubernetes/4.0.x/getting-started/using-trilio/getting-started-1/triliovault-crds.md).

**Note:**

1. Backup and BackupPlan should be created in the same namespace.
2. For the restore operation, the resources will get restored in the namespace where restore CR is created.
3. If there is more than one backup created for the same application, users can select any existing backup information to perform the restore.

## Step 4.1: Label Example <a href="#label-example" id="label-example"></a>

The following sections will create a sample application (tag it with labels), backup the application via labels, and then restore the application.

The following steps will be performed.

1. Create a sample MySQL application
2. Create a BackupPlan CR using a management console that specifies the MySQL application via labels
3. Create a Backup CR using the management console with a reference to the BackupPlan CR created above
4. Create a Restore CR using the management console with a reference to the Backup CR created above.

### Create a Sample Application

Use the following screenshot to assist in the deployment of the MySQL application using the label.

![T4K has auto-discovered the application from backup namespace](/files/IMe1d2CjsQynFzNgxgsS)

### Create a BackupPlan

Create a BackupPlan CR by selecting the application created in the previous step via UI labels in the same namespace where the application resides.

![Select application deployed by label app:mysql and create new BackupPlan](/files/se9PagpTniENQ4qxmjBY)

### Create a Backup

Create a Backup CR using UI to protect the BackupPlan. `Type` of the backup can be either *full* or *incremental*.

Note: The first backup into a target location will always be a Full backup.

![Select the BackupPlan and enter backup name. MySQL demo application backup is in-progress state.](/files/aBto1mUvDKrt4ahImIHh)

![Application scoped backup of MySQL app deployed by label is successful](/files/jjkA88YL1LDvk0z4KfYs)

![Details of the demo-mysql-label-backup](/files/U3cWJ2nvdXWrdLpxgczn)

### Restore the Backup/Application

Finally create the Restore CR using UI to restore the Backup, in the same or different namespace using the Backup. In the example provided below, MySQL-label-backup is being restored into the "restore" namespace.

**Restore to the same cluster but a different namespace**

**Note**: If restoring into the same namespace, ensure that the original application components have been removed. If restoring into another namespace in the same cluster, ensure that the resources that cannot be shared like ports should be freed or transformation should be used to avoid conflict. More information about transformation can be found at [Restore Transformation](https://docs.trilio.io/kubernetes/v/2.1.0/overview/features-and-use-cases#restore-tranforms).

![Select the restore point and click on the Restore button. Provide restore name and restore namespace. demo-mysql-label-restore is in progress state](/files/sQM86FKKS9ihXBpYl5A1)

![MySQL application is restored to restore namespace](/files/NhJLU5DH07zPJA3R3Igp)

#### Restoring to a different cluster <a href="#restoring-to-a-different-cluster" id="restoring-to-a-different-cluster"></a>

**Note**: If restoring to another cluster (migration scenario), ensure that Trilio for Kubernetes is also running in the remote namespace/cluster. To restore into a new cluster (where the Backup CR does not exist), the same target should be created and Target Browsing should be enabled to browse the stored backups.

![Enable the Target Browsing for the Target. Use the Launch Browser option and search backup using the backupPlan name. Select the backup and click on Restore. Provide restore name and restore namespace.](/files/7F3j3sBFHyjbZBfmjY6G)

![Restore to a different cluster is successful](/files/07QZwoNumIgraG7RB7MP)

![MySQL application after the restore to a different cluster is successful](/files/NhJLU5DH07zPJA3R3Igp)

## Step 4.2: Helm Example

The following sections will create a sample application via Helm, backup the application via Helm selector fields and then restore the application using management UI.

The following steps will be performed.

1. Create a cockroachdb instance using Helm
2. Create a BackupPlan CR using a management console that specifies the cockroachdb application to protect.
3. Create a Backup CR using the management console with a reference to the BackupPlan CR created above.
4. Create a Restore CR using the management console referencing the Backup CR created above.

### Create a sample application via Helm

Use the following screenshot to assist in the deployment of the "Cockroachdb" application using the helm chart.

![Auto-discovered cockroachdb helm application](/files/Vganed2EIG6Bcx9p8sRq)

### Create a BackupPlan <a href="#create-a-backupplan-1" id="create-a-backupplan-1"></a>

Use the following to create a BackupPlan. Ensure the name of the release you specify matches the output from the helm ls command in the previous step.

![Enter backupplan name and select target repository. Cockroachdb helm release is part of the backupplan](/files/LMrcz8fNifSVG8VYOCM3)

### Create a Backup

Use the following screenshot to create a backup CR

![Select above created backupplan. Enter the backup name. demo-cockroachdb-helm-backup is in progress state](/files/nEuEE07zkuCb9YfPmP5B)

![demo-cockroachdb-helm-backup is in Available state](/files/DexEXuIgx5mqdw7Z82ax)

### Restore Backup/Application

After the backup has been completed successfully, create a Restore CR to restore the application in the same or different namespace where BackupPlan and Backup CRs are created.

**Note**: If restoring into the same namespace, ensure that the original application components have been removed. Especially the PVC of the application is deleted.

**Restore to the same cluster but a different namespace**

**Note:** If restoring into another namespace in the same cluster, ensure that the resources which cannot be shared like ports should be freed or transformation should be used to avoid conflict. More information about transformation can be found at [Restore Transformation](https://docs.trilio.io/kubernetes/v/2.1.0/overview/features-and-use-cases#restore-tranforms).

Before restoring the app, we need to clean the existing app from the same cluster. This is required cluster-level resources of the app can create conflict during the restore operation.

```
helm delete cockroachdb-app
```

![Select the backup created above from the Restore Points. Enter the restore name and select the restore namespace. demo-cockroachdb-helm-restore is in progress state](/files/hzpMjSquav0dZhO5pPbe)

![Restore is in Completed state](/files/R5E1wo7K1sOpXJJMPuMl)

![After restore, cockroachdb helm application is restored in restore namespace](/files/wI9gjKRSrKDt6Uncz33G)

**Restore to the different cluster**

**Note**: If restoring to another cluster (migration scenario), ensure that Trilio for Kubernetes is also running in the remote namespace/cluster. To restore into a new cluster (where the Backup CR does not exist), the same target should be created and Target Browsing should be enabled to browse the stored backups.

After following the above note follow the instructions same as Restore the backup/application by label section to choose the namespace backup stored at the target repository and perform the helm backup restore.

## Step 4.3: Operator Example

The following steps will be performed.

1. Install a sample etcd Operator
2. Create an etcd cluster
3. Create a BackupPlan CR using the management console that specifies the etcd application to protect.
4. Create a Backup CR using the management console with a reference to the BackupPlan CR created above
5. Create a Restore CR using the management console referencing the Backup CR created above.

We are demonstrating standard 'etcd-operator' here. First, we need to deploy the operator using its helm chart. Then we need to deploy the etcd cluster.\
Follow [Install etcd-operator](/kubernetes/4.0.x/getting-started/using-trilio/getting-started-1.md#install-etcd-operator) and [Create an etcd cluster using the following yaml definition](/kubernetes/4.0.x/getting-started/using-trilio/getting-started-1.md#create-an-etcd-cluster-using-following-yaml-definition) section to install and create an etcd cluster.

![T4K auto-discovered the etcd operator in the backup ns](/files/Jon4gE683FpdX8YDMUNT)

### Create a BackupPlan

Create a 'BackupPlan' resource to protect 'etcd-operator' and it's clusters. Use the management console to select the etcd-operator auto-discovered by T4K and shown under the Operator section.

![Create a backupplan for auto-discovered etcd operator. etcd operator resources captured as a part of backupplan](/files/kZqyKm2UCaplGLb88AxJ)

### Create a Backup

Take a backup of the above 'BackupPlan'. Use the following screenshot to proceed and create a 'Backup' resource.

![Select the above created backupplan and enter backup name. etcd operator backup is in-progress state](/files/OZnCItfAjsqd9duXx9Er)

![etcd operator backup is in Available state](/files/XF5q1nJjOqRC2rlonuOW)

### Restore the Backup/Application

* After the backup completes successfully, you can perform the Restore of it.
* To restore the etcd-operator and its clusters from the above backup, use the screenshots shown below.

**Note**: If restoring into the same namespace, ensure that the original application components have been removed.

**Restore to the same cluster but a different namespace**

**Note:** If restoring into another namespace in the same cluster, ensure that the resources that cannot be shared, for example, ports - should be available or transformation should be used to avoid conflict. More information about transformation can be found at [Restore Transformation](https://docs.trilio.io/kubernetes/v/2.1.0/overview/features-and-use-cases#restore-tranforms).

Before restoring the app, we need to clean the existing app from the same cluster. This is required cluster-level resources of the app can create conflict during the restore operation.

![Select the backup created above from the Restore Points. Enter the restore name and select the restore namespace. demo-etcd-operator-restore is in-progress state](/files/jMbLYEt5sUOZ8i7RNw2F)

![Restore is in Completed state](/files/fCU3GDxr2ygc6KI6OndW)

## Step 4.4: Virtual Machine Example

The following sections will describe the steps to create a sample Virtual Machine, backup the Virtual Machine like any other Helm and Operator application, and then restore the Virtual Machine using the management UI.

The following steps will be performed.

1. Create a Virtual Machine using OpenShift Virtualization Operator.

Users can follow the Red Hat demo [here](https://www.youtube.com/watch?v=WN9EnqbG8NI) to learn how to deploy a VM.\\

<figure><img src="/files/khw3v3K0GAAEnZJF3Chk" alt=""><figcaption><p>Virtual Machine running in the OpenShift Container Platform</p></figcaption></figure>

1. Create a BackupPlan CR using a management console that specifies the `centos9` Virtual Machines to protect.
2. Create a Backup CR using the management console referencing the BackupPlan CR created in step 1.
3. Create a Restore CR using the management console again referencing the Backup CR created in step 1.

### Create a Backupplan

Use the following screenshot to assist in the creation of a BackupPlan for the Virtual Machine, ensuring that the name of the Virtual Machine you specify matches the VM created in the previous step.

<figure><img src="/files/LflF9lZbZLCwbcgdASr8" alt=""><figcaption><p>Virtual Machine auto-discovered by the Trilio for Kubernetes. Create New Backup for Virtual Machine. Provide Backupplan name, Target, and other details. Provide Scheduling Policy, and Retention Policy for the BackupPlan. Virtual Machine Parameters are added under the Custom Component Details.</p></figcaption></figure>

<figure><img src="/files/k0ki2uNxrDgs2b69GwKO" alt=""><figcaption><p>Wait for sync up to complete</p></figcaption></figure>

### Create a Backup

Create a backup CR as shown in the following screenshots.

<figure><img src="/files/RSdwUCOsXoblUkWLJMfa" alt=""><figcaption><p>Provide the Backup name. The demo-vm-backup is in in-progress state.</p></figcaption></figure>

<figure><img src="/files/KHjpaaAGTu2VRHi1xV6v" alt=""><figcaption><p>Different stages of backup - Data snapshot and data upload</p></figcaption></figure>

### Restore Backup/Virtual Machine

#### Restore to the same cluster

After the backup has been completed successfully, create a Restore CR to restore the Virtual Machine in the same or different namespace where BackupPlan and Backup CRs are created.

<figure><img src="/files/tmG6Mc4l2zkEvbzX8Uv5" alt=""><figcaption><p>View Backup and Restore Summary for Virtual Machine. View Backup and Restore Summary for Virtual Machine. Provide Restore CR name and Restore Namespace. No transformation is required, click on Create.</p></figcaption></figure>

<figure><img src="/files/jaHN7NmBcDhnuKZaKujZ" alt=""><figcaption><p>Restore is complete with both VM disks restored correctly</p></figcaption></figure>

####

#### Restore to the different cluster

**Note**: If restoring to another cluster (migration scenario), ensure that Trilio for Kubernetes is also running in the remote namespace/cluster. To restore into a new cluster (where the Backup CR does not exist), the same backup target should be created and Target Browsing should be enabled to browse the stored backups.

After following the above note follow the instructions same as Restore the backup/application by label section to choose the namespace backup stored at the target repository and perform the helm backup restore.

#### Validate the Restored Virtual Machine

Once the restore is complete, you can log in to the OpenShift Container Platform, go to the restore namespace and check that the Virtual Machine is restored correctly and is in the `Running` state.

<figure><img src="/files/awDnPo36yShfoMNC01lx" alt=""><figcaption><p>VM with name is restored in vm-restore namespace</p></figcaption></figure>

## Step 4.5: Namespace Example

1. Create a namespace called 'wordpress'
2. Use Helm to deploy a wordpress application into the namespace.
3. Perform a backup of the namespace using the management console
4. Delete the namespace/application from the kubernetes cluster
5. Create a new namespace 'restore'
6. Perform a Restore of the namespace using the management console

### Create a namespace and application <a href="#create-a-namespace-and-application" id="create-a-namespace-and-application"></a>

Follow the [Create a namespace and application](/kubernetes/4.0.x/getting-started/using-trilio/getting-started-1.md#create-a-namespace-and-application) section to create an application.

### Create a BackupPlan

Create a backupPlan to backup the namespace using the management console

![Auto-discovered namespaces. Create demo-ns-backupplan. demo-ns-backupplan is in Available state](/files/Jw5WEI4lsnAVRDSDj9SZ)

### Backup the Namespace

Use the following screenshot to build the Backup CR using the management console

![Select the backupplan name if present for a namespace. Select the auto-discovered backupplan name created above for backup ns. Provide backup name demo-ns-backup. demo-ns-backup operation is in progress](/files/Zln5zHmqgfOPa2nbjvS3)

![Namespace scoped backup is sucessful](/files/HRqsRsvsWQiHI83Ypgeh)

![Namespace scoped backup demo-ns-backup is in available state](/files/1EJTYI9MMCktkYDwveXv)

### Restore the Backup/Namespace

Perform a restore of the namespace backup using the management console

#### Restore to the same cluster but a different namespace

**Note**: If restoring into the same namespace, ensure that the original application components have been removed. If restoring into another namespace in the same cluster, ensure that the resources that cannot be shared like ports should be freed or transformation should be used to avoid conflict. More information about transformation can be found at [Restore Transformation](https://docs.trilio.io/kubernetes/v/2.1.0/overview/features-and-use-cases#restore-tranforms).

![Select demo-ns-backup from Restore Points and click on the Restore button. Provide the restore name and restore namespace. demo-ns-restore is in-progress state](/files/duCrpGfBjmo3Vtq2TZyL)

#### Validate Restore

![backup ns is restored into restore namespace with applications](/files/NhJLU5DH07zPJA3R3Igp)

#### Validate Application Pods

```
kubectl get pods -n restore
```

```
$ root@my-host:~# kubectl get pods -n restore
NAME                                    READY   STATUS    RESTARTS   AGE
k8s-demo-app-frontend-7c4bdbf9b-4hsl2   1/1     Running   0          2m56s
k8s-demo-app-frontend-7c4bdbf9b-qm84p   1/1     Running   0          2m56s
k8s-demo-app-frontend-7c4bdbf9b-xmrxk   1/1     Running   0          2m56s
k8s-demo-app-mysql-754f46dbd7-cj5z5     1/1     Running   0          2m56s
```

**Restore to the different cluster**

If you are trying to restore into a different cluster then follow the guidelines same as[#restoring-to-a-different-cluster](#restoring-to-a-different-cluster "mention") section to choose the namespace backup stored at the target repository and perform the namespace restore.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trilio.io/kubernetes/4.0.x/getting-started/using-trilio/getting-started-with-management-console.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
