Configure Velero with Azure, or GCP storage
Configure Velero to use Azure Blob Storage
Prerequisites: Create Azure related assets such as storage account, blob containers, resource group, roles, service principals prior to continuing.
Confirm that you have created your storage account, and your blob container using these instructions.
Prep your credentials-velero file with the values. You will need to use the same credentials that you created when creating the cluster. Please note that these credentials should not be Base64 encoded, as Velero will not read them properly. Export the
AZURE_BACKUP_RESOURCE_GROUP
that you created in the last step to be theAZURE_RESOURCE_GROUP
in this step (in a later step, you will also useAZURE_BACKUP_RESOURCE_GROUP
).CODEcat << EOF > ./credentials-velero AZURE_SUBSCRIPTION_ID=${AZURE_SUBSCRIPTION_ID} AZURE_TENANT_ID=${AZURE_TENANT_ID} AZURE_CLIENT_ID=${AZURE_CLIENT_ID} AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET} AZURE_RESOURCE_GROUP=${AZURE_RESOURCE_GROUP} AZURE_CLOUD_NAME=AzurePublicCloud EOF
Use the credentials-velero file to create the secret (in this case, it is named as
azure-bsl-credentials
). Note that we used --from-env-file referencing thecredentials-velero
file. If you are backing up the Management cluster, the namespace iskommander
.CODEkubectl create secret generic -n ${WORKSPACE_NAMESPACE} azure-bsl-credentials --from-file=azure="credentials-velero" --kubeconfig=${CLUSTER_NAME}.conf
Configure Velero on Attached or Managed Clusters
Set the
WORKSPACE_NAMESPACE
environment variable to the name of the workspace’s namespaceCODEexport WORKSPACE_NAMESPACE=<your_workspace_namespace>
Create a ConfigMap to apply Azure to the Velero configuration
CODEcat <<EOF | kubectl apply -f - apiVersion: v1 kind: ConfigMap metadata: namespace: ${WORKSPACE_NAMESPACE} name: velero-overrides data: values.yaml: | initContainers: - name: velero-plugin-for-aws image: velero/velero-plugin-for-aws:v1.1.0 imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins - name: velero-plugin-for-microsoft-azure image: velero/velero-plugin-for-microsoft-azure:v1.5.1 imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins credentials: extraSecretRef: azure-bsl-credentials EOF
Patch the Velero AppDeployment by adding the configOverrides value. This applies the ConfigMap to your instance after the cluster has been configured.
CODEcat << EOF | kubectl -n ${WORKSPACE_NAMESPACE} patch appdeployment velero --type="merge" --patch-file=/dev/stdin spec: configOverrides: name: velero-overrides EOF
After patching the AppDeployment, you will see the ConfigMap on the
HelmRelease
objectCODEkubectl wait --for=jsonpath='{.spec.valuesFrom[1].name}'=velero-overrides HelmRelease/velero -n ${WORKSPACE_NAMESPACE}
Create the backup storage location via Velero CLI (note that this calls for the
BLOB_CONTAINER
andAZURE_STORAGE_ACCOUNT_ID
variable that was used when creating the blob container in step 1, as well as theAZURE_BACKUP_SUBSCRIPTION_ID
which will be the same as theAZURE_SUBSCRIPTION_ID
set previously):BASHvelero backup-location create azure -n ${WORKSPACE_NAMESPACE} \ --provider azure \ --bucket ${BLOB_CONTAINER} \ --config resourceGroup=${AZURE_BACKUP_RESOURCE_GROUP},storageAccount=${AZURE_STORAGE_ACCOUNT_ID},subscriptionId=${AZURE_BACKUP_SUBSCRIPTION_ID} \ --credential=azure-bsl-credentials=azure --kubeconfig=${CLUSTER_NAME}.conf
Verify that the Azure backup location is created:
BASHvelero backup-location get -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.conf
Check the Helm releases that the new Velero configuration has been applied:
CODEkubectl get helmrelease -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.conf
Verify that the Velero pod is running:
CODEkubectl get pods -A --kubeconfig=${CLUSTER_NAME}.conf |grep velero
Create a test backup for Azure:
CODEvelero backup create azure-velero-testbackup -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.conf --storage-location azure --snapshot-volumes=false
View your backup:
CODEvelero backup describe azure-velero-testbackup
Configure Velero on the Management Cluster
Create the backup storage location via Velero CLI (note that this calls for the
BLOB_CONTAINER
andAZURE_STORAGE_ACCOUNT_ID
variable that was used when creating the blob container in step 1, as well as theAZURE_BACKUP_SUBSCRIPTION_ID
which will be the same as theAZURE_SUBSCRIPTION_ID
set earlier):BASHvelero backup-location create azure -n kommander \ --provider azure \ --bucket ${BLOB_CONTAINER} \ --config resourceGroup=${AZURE_BACKUP_RESOURCE_GROUP},storageAccount=${AZURE_STORAGE_ACCOUNT_ID},subscriptionId=${AZURE_BACKUP_SUBSCRIPTION_ID} \ --credential=azure-bsl-credentials=azure --kubeconfig=${CLUSTER_NAME}.conf
Verify that the Azure backup location is created:
BASHvelero backup-location get -n kommander --kubeconfig=${CLUSTER_NAME}.conf
Output the Kommander configuration to
kommander.yaml
(or use your existing configuration file)CODEdkp install kommander -o yaml --init > kommander.yaml
Configure DKP to load the plugins and to include the secret in the
apps.velero
section:
NOTE: This process has been tested to work with plugins for AWS v1.1.0 and Azure v1.5.1. Newer versions of these plugins can be used, but have not been tested by D2iQ.YAML... velero: enabled: true values: | initContainers: - name: velero-plugin-for-aws image: velero/velero-plugin-for-aws:v1.1.0 imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins - name: velero-plugin-for-microsoft-azure image: velero/velero-plugin-for-microsoft-azure:v1.5.1 imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins credentials: extraSecretRef: azure-bsl-credentials ...
Use the modified
kommander.yaml
configuration in install this Velero configuration:CODEdkp install kommander --installer-config kommander.yaml --kubeconfig=${CLUSTER_NAME}.conf
Check the Helm releases that the new Velero configuration applied/loaded:
CODEkubectl get helmrelease -n kommander --kubeconfig=${CLUSTER_NAME}.conf
Ensure that the Velero pod is running:
CODEkubectl get pods -A --kubeconfig=${CLUSTER_NAME}.conf |grep velero
Create a test backup for Azure:
CODEvelero backup create azure-velero-testbackup -n kommander --kubeconfig=${CLUSTER_NAME}.conf --storage-location azure --snapshot-volumes=false
View your backup:
CODEvelero backup describe azure-velero-testbackup
Configure Velero to use Google Cloud Buckets
You can also store your backups in Google Cloud/GCP.
See the official docs for details on how to use different types of authentication.
Prerequisites: Create GCP related assets such as GCS Bucket, GCP project, service accounts, and service account keys prior to continuing, and the velero
, gcloud
, and gsutil
CLIs installed locally (gsutil
is optional, you may buckets through the GCP web application).
Confirm that you have created your storage account, and your bucket, using these instructions.
Prep your credentials-velero file with the values, using the
SERVICE_ACCOUNT_EMAIL
you used to grant permissions to your bucket. This creates acredentials-velero
file in your local directory.CODEgcloud iam service-accounts keys create credentials-velero \ --iam-account $SERVICE_ACCOUNT_EMAIL
Use the
credentials-velero
file to create the secret (in this case, we named itbsl-credentials
). Note that we used --from-env-file referencing thecredentials-velero
file. If you are backing up the Management cluster, the namespace iskommander
.CODEkubectl create secret generic -n ${WORKSPACE_NAMESPACE} bsl-credentials --from-file=gcp=credentials-velero --kubeconfig=${CLUSTER_NAME}.conf
Configuring Velero on Attached or Managed Clusters
Set the
WORKSPACE_NAMESPACE
environment variable to the name of the workspace’s namespaceCODEexport WORKSPACE_NAMESPACE=<your_workspace_namespace>
Create the backup storage location via Velero CLI (note that this calls for the
BUCKET
variable that was used when creating the bucket container in step 1:CODEvelero backup-location create gcp-backup -n ${WORKSPACE_NAMESPACE} \ --provider gcp \ --bucket $BUCKET \ --credential=bsl-credentials=gcp
Verify that the GCP backup location is created:
BASHvelero backup-location get -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.conf
Create a ConfigMap to apply GCP to the Velero configuration
CODEcat <<EOF | kubectl apply -f - apiVersion: v1 kind: ConfigMap metadata: namespace: ${WORKSPACE_NAMESPACE} name: velero-overrides data: values.yaml: | initContainers: - name: velero-plugin-for-aws image: velero/velero-plugin-for-aws:v1.1.0 imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins - name: velero-plugin-for-gcp image: velero/velero-plugin-for-gcp:v1.5.0 imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins credentials: extraSecretRef: bsl-credentials EOF
Patch the Velero AppDeployment by adding the configOverrides value. This applies the ConfigMap in thisinstance after the cluster has been configured.
CODEcat << EOF | kubectl -n ${WORKSPACE_NAMESPACE} patch appdeployment velero --type="merge" --patch-file=/dev/stdin spec: configOverrides: name: velero-overrides EOF
After patching the AppDeployment, you will see the ConfigMap on the
HelmRelease
object:CODEkubectl wait --for=jsonpath='{.spec.valuesFrom[1].name}'=velero-overrides HelmRelease/velero -n ${WORKSPACE_NAMESPACE}
Check the Helm releases that the new Velero configuration applied/loaded:
CODEkubectl get helmrelease -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.conf
Ensure that the Velero pod is running:
CODEkubectl get pods -A --kubeconfig=${CLUSTER_NAME}.conf |grep velero
Create a test backup for GCP:
CODEvelero backup create gcp-velero-testbackup -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.conf --storage-location gcp-backup --snapshot-volumes=false
Please note: if your backup wasn’t created, Velero may have had an issue installing the plugin. If the plugin was not installed, run this command:
CODEvelero plugin add velero/velero-plugin-for-gcp:v1.5.0 -n ${WORKSPACE_NAMESPACE}
And then confirm your
backupstoragelocation
was configured correctlyCODEkubectl get backupstoragelocations -n ${WORKSPACE_NAMESPACE}
If your backup storage location is “Available”, repeat step 9 and proceed to the rest of the setup
CODENAME PHASE LAST VALIDATED AGE DEFAULT gcp-backup Available 38s 60m
View your backup:
CODEvelero backup describe gcp-velero-testbackup
Configuring Velero on the Management Cluster
Create the backup storage location via Velero CLI (note that this calls for the
BUCKET
variable that was used when creating the bucket container in step 1):CODEvelero backup-location create gcp-backup -n kommander \ --provider gcp \ --bucket $BUCKET \ --credential=bsl-credentials=gcp
Verify that the GCP backup location is created:
BASHvelero backup-location get -n kommander --kubeconfig=${CLUSTER_NAME}.conf
Output the Kommander configuration to
kommander.yaml
(or use your existing configuration file)CODEdkp install kommander -o yaml --init > kommander.yaml
Configure DKP to load the plugins and to include the secret under the
apps.velero
section:
NOTE: This process has been tested to work with plugins for AWS v1.1.0 and GCP v1.5.0. Newer versions of these plugins can be used, but have not been tested by D2iQ.YAML... velero: enabled: true values: | initContainers: - name: velero-plugin-for-aws image: velero/velero-plugin-for-aws:v1.1.0 imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins - name: velero-plugin-for-gcp image: velero/velero-plugin-for-gcp:v1.5.0 imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins credentials: extraSecretRef: bsl-credentials ...
Use the modified
kommander.yaml
configuration to install this Velero configuration:CODEdkp install kommander --installer-config kommander.yaml --kubeconfig=${CLUSTER_NAME}.conf
Check the Helm releases that the new Velero configuration applied/loaded (this normally takes a few minutes to catch up after running the install command):
CODEkubectl get helmrelease -n kommander --kubeconfig=${CLUSTER_NAME}.conf
Ensure that the Velero pod is running:
CODEkubectl get pods -A --kubeconfig=${CLUSTER_NAME}.conf |grep velero
Create a test backup for GCP:
CODEvelero backup create gcp-velero-testbackup -n kommander --kubeconfig=${CLUSTER_NAME}.conf --storage-location gcp-backup --snapshot-volumes=false
Please note: if your backup wasn’t created, Velero may have had an issue installing the plugin. If the plugin was not installed, run this command:
CODEvelero plugin add velero/velero-plugin-for-gcp:v1.5.0 -n kommander
And then confirm your
backupstoragelocation
was configured correctlyCODEkubectl get backupstoragelocations -n kommander
If your backup storage location is “Available”, repeat step 8 and proceed to the rest of the setup
CODENAME PHASE LAST VALIDATED AGE DEFAULT gcp-backup Available 38s 60m
View your backup:
CODEvelero backup describe gcp-velero-testbackup