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_GROUPthat you created in the last step to be theAZURE_RESOURCE_GROUPin 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 EOFUse 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-velerofile. 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_NAMESPACEenvironment 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 EOFPatch 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 EOFAfter patching the AppDeployment, you will see the ConfigMap on the
HelmReleaseobjectCODEkubectl 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_CONTAINERandAZURE_STORAGE_ACCOUNT_IDvariable that was used when creating the blob container in step 1, as well as theAZURE_BACKUP_SUBSCRIPTION_IDwhich will be the same as theAZURE_SUBSCRIPTION_IDset 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}.confVerify that the Azure backup location is created:
BASHvelero backup-location get -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.confCheck the Helm releases that the new Velero configuration has been applied:
CODEkubectl get helmrelease -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.confVerify that the Velero pod is running:
CODEkubectl get pods -A --kubeconfig=${CLUSTER_NAME}.conf |grep veleroCreate a test backup for Azure:
CODEvelero backup create azure-velero-testbackup -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.conf --storage-location azure --snapshot-volumes=falseView 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_CONTAINERandAZURE_STORAGE_ACCOUNT_IDvariable that was used when creating the blob container in step 1, as well as theAZURE_BACKUP_SUBSCRIPTION_IDwhich will be the same as theAZURE_SUBSCRIPTION_IDset 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}.confVerify that the Azure backup location is created:
BASHvelero backup-location get -n kommander --kubeconfig=${CLUSTER_NAME}.confOutput the Kommander configuration to
kommander.yaml(or use your existing configuration file)CODEdkp install kommander -o yaml --init > kommander.yamlConfigure DKP to load the plugins and to include the secret in the
apps.velerosection:
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.yamlconfiguration in install this Velero configuration:CODEdkp install kommander --installer-config kommander.yaml --kubeconfig=${CLUSTER_NAME}.confCheck the Helm releases that the new Velero configuration applied/loaded:
CODEkubectl get helmrelease -n kommander --kubeconfig=${CLUSTER_NAME}.confEnsure that the Velero pod is running:
CODEkubectl get pods -A --kubeconfig=${CLUSTER_NAME}.conf |grep veleroCreate a test backup for Azure:
CODEvelero backup create azure-velero-testbackup -n kommander --kubeconfig=${CLUSTER_NAME}.conf --storage-location azure --snapshot-volumes=falseView 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_EMAILyou used to grant permissions to your bucket. This creates acredentials-velerofile in your local directory.CODEgcloud iam service-accounts keys create credentials-velero \ --iam-account $SERVICE_ACCOUNT_EMAILUse the
credentials-velerofile to create the secret (in this case, we named itbsl-credentials). Note that we used --from-env-file referencing thecredentials-velerofile. 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_NAMESPACEenvironment 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
BUCKETvariable 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=gcpVerify that the GCP backup location is created:
BASHvelero backup-location get -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.confCreate 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 EOFPatch 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 EOFAfter patching the AppDeployment, you will see the ConfigMap on the
HelmReleaseobject: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}.confEnsure that the Velero pod is running:
CODEkubectl get pods -A --kubeconfig=${CLUSTER_NAME}.conf |grep veleroCreate a test backup for GCP:
CODEvelero backup create gcp-velero-testbackup -n ${WORKSPACE_NAMESPACE} --kubeconfig=${CLUSTER_NAME}.conf --storage-location gcp-backup --snapshot-volumes=falsePlease 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
backupstoragelocationwas 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 60mView 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
BUCKETvariable 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=gcpVerify that the GCP backup location is created:
BASHvelero backup-location get -n kommander --kubeconfig=${CLUSTER_NAME}.confOutput the Kommander configuration to
kommander.yaml(or use your existing configuration file)CODEdkp install kommander -o yaml --init > kommander.yamlConfigure DKP to load the plugins and to include the secret under the
apps.velerosection:
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.yamlconfiguration to install this Velero configuration:CODEdkp install kommander --installer-config kommander.yaml --kubeconfig=${CLUSTER_NAME}.confCheck 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}.confEnsure that the Velero pod is running:
CODEkubectl get pods -A --kubeconfig=${CLUSTER_NAME}.conf |grep veleroCreate a test backup for GCP:
CODEvelero backup create gcp-velero-testbackup -n kommander --kubeconfig=${CLUSTER_NAME}.conf --storage-location gcp-backup --snapshot-volumes=falsePlease 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 kommanderAnd then confirm your
backupstoragelocationwas configured correctlyCODEkubectl get backupstoragelocations -n kommanderIf 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 60mView your backup:
CODEvelero backup describe gcp-velero-testbackup