Preparing the Azure Kubernetes Service cluster to back up the server data

When you want to back up the server data, you must prepare your Azure Kubernetes Service (AKS) cluster to store the backed-up data.

Before you begin

You must have completed the following tasks:

  • Created an Azure subscription along with an Owner or Contributor and User-Access Administrator role on the Azure subscription.

    You can create a subscription from Microsoft Azure if you do not have a valid subscription.

  • Downloaded the Velero 1.5.3 plug-in for Microsoft Azure from the Velero repository.

    CAUTION: The instructions provided in this procedure are an example of how an AKS cluster can be configured to use Velero 1.5.3 Microsoft Azure plug-in for backing up and restoring the HCL OneTest Server data. The procedures to backup and restore the server data might be not valid in all the scenarios.
  • Copied the Velero executable file into one of the directories in the PATH environment variable.

  • Installed Azure Command-Line Interface (CLI). For more information, refer to the Azure CLI documentation.

About this task

Velero is one of the tools that is available to back up and restore the server data. You must prepare your AKS cluster where you installed HCL OneTest Server before you back up the data by using Velero.

Procedure

  1. Run the following command to log in to AKS interactively:
    az login
    The command-line interface opens a browser and displays the Log-in page of AKS.
  2. Sign in with your AKS account credentials.
  3. Run the following command to set your active subscription:
    az account set --subscription <subscription_name>

    You must replace <subscription_name> with the name of your active Azure subscription.

  4. Run the following command to set the location of your AKS cluster:
    az configure --defaults location=<location_name>

    For example, az configure --defaults location=eastus2

    Tip: You can run the following command to get the list of all the available locations:
    az account list-locations --query "[].{DisplayName:displayName, Name:name}" -o table
  5. Run the following commands to create a storage account within the AKS cluster for the Velero to store the backup files:
    AZURE_BACKUP_SUBSCRIPTION_NAME=<subscription_name>
    AZURE_BACKUP_SUBSCRIPTION_ID=$(az account list --query="[?name=='$AZURE_BACKUP_SUBSCRIPTION_NAME'].id | [0]" -o tsv)
    AZURE_BACKUP_RESOURCE_GROUP=Velero_Backups
    
    az group create -n $AZURE_BACKUP_RESOURCE_GROUP --location <location_name>
    
    AZURE_STORAGE_ACCOUNT_ID="velero$(date -u +%s)"
    az storage account create \
    --name $AZURE_STORAGE_ACCOUNT_ID \
    --resource-group $AZURE_BACKUP_RESOURCE_GROUP \
    --sku Standard_GRS \
    --encryption-services blob \
    --https-only true \
    --kind BlobStorage \
    --access-tier Hot
    
    Note: You must replace <subscription_name> and <location_name> with the name of your active Azure subscription and location of the AKS cluster.
  6. Run the following command to create a container within the storage account to store the backup files:
    AZURE_BLOB_CONTAINER=velero
    az storage container create -n $AZURE_BLOB_CONTAINER --public-access off --account-name $AZURE_STORAGE_ACCOUNT_ID
  7. Run the following commands to obtain a key of Azure storage account and to create a file that contains all the relevant environment variables:
    AZURE_STORAGE_ACCOUNT_ACCESS_KEY=$(az storage account keys list \
    --account-name $AZURE_STORAGE_ACCOUNT_ID \
    --query "[?keyName == 'key1'].value" -o tsv)
    
    cat << EOF  > ./credentials-velero
    AZURE_STORAGE_ACCOUNT_ACCESS_KEY=${AZURE_STORAGE_ACCOUNT_ACCESS_KEY}
    AZURE_CLOUD_NAME=AzurePublicCloud
    EOF
    Note: There are several ways Velero can authenticate to Azure. This procedure is based on using a storage account access key. The available values for AZURE_CLOUD_NAME in the Storage account access key method are AzurePublicCloud, AzureUSGovernmentCloud, AzureChinaCloud, and AzureGermanCloud.
  8. Run the following command to install Velero with the restic option by using the Azure storage account key:
    velero install \
    --provider azure \
    --plugins velero/velero-plug-in-for-microsoft-azure:v1.1.0 \
    --bucket $AZURE_BLOB_CONTAINER \
    --secret-file ./credentials-velero \
    --backup-location-config resourceGroup=$AZURE_BACKUP_RESOURCE_GROUP,storageAccount=$AZURE_STORAGE_ACCOUNT_ID,storageAccountKeyEnvVar=AZURE_STORAGE_ACCOUNT_ACCESS_KEY,subscriptionId=$AZURE_BACKUP_SUBSCRIPTION_ID \
    --use-volume-snapshots=false \
    --use-restic
    

Results

You have prepared your cluster to back up the server data.

What to do next

You can back up the server data. See Backing up the server data on Azure Kubernetes Service