Preparing for Backups#
Note
The following instructions are tailored for AWS. Please adapt them to your chosen platform and storage.
Before you create a manual one-off or scheduled backup, review the steps below and update your configuration accordingly:
-
Verify whether the
veleroplugins have been installed as suggested in Velero installation. If theveleroplugins with the desired storage option are already configured, please skip the next step. -
If no
veleroplugins have yet been installed in your k0rdent cluster, start by editing thekcmmanagementobject so that the velero plugin details are filled in underspec.core.kcm:kubectl edit managements kcmapiVersion: k0rdent.mirantis.com/v1beta1 kind: Management metadata: name: kcm spec: # ... core: kcm: config: regional: velero: initContainers: - name: velero-plugin-for-<PROVIDER-NAME> image: velero/velero-plugin-for-<PROVIDER-NAME>:<PROVIDER-PLUGIN-TAG> imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins # ...For the regional cluster case, edit the corresponding
regionobject in a similar way:kubectl edit regions <region-name>apiVersion: k0rdent.mirantis.com/v1beta1 kind: Region metadata: name: <region-name> spec: # ... core: kcm: config: velero: initContainers: - name: velero-plugin-for-<PROVIDER-NAME> image: velero/velero-plugin-for-<PROVIDER-NAME>:<PROVIDER-PLUGIN-TAG> imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /target name: plugins # ...Note, that the only change is the absence of the
regionalsubpath.Please review Velero's Docker Hub image plugin repositories to help identify the required
<PROVIDER-NAME>. Once the required image has been identified, select from the available tags to determine the correct<PROVIDER-PLUGIN-TAG>. In the case of AWS, the name would bevelero-plugin-for-aws, we can select from the available tags. -
Prepare a storage location, such as an Amazon S3 bucket, to store k0rdent backups.
-
Prepare a yaml containing a
BackupStorageLocationobject referencing aSecretwith credentials to access the cloud storage (if the multiple credentials feature is supported by the plugin). For example, you can create theBackupStorageLocationand the relatedSecretyaml for the Amazon S3 configuration by following these steps.First create a file called
credentials.txtwith your credentials, as in:[default] aws_access_key_id = EXAMPLE_ACCESS_KEY_ID aws_secret_access_key = EXAMPLE_SECRET_ACCESS_KEYThe IAM user being used in this configuration will require certain permissions for the appropriate Velero S3 bucket access. Review the necessary permissions here. Reference the JSON policy file named
velero-policy.jsonand take care to replace${BUCKET}with the correct bucket name).Note
If you're using EKS, the "user" is actually a role. If you get an error such as...
AccessDenied: User: arn:aws:sts::026090528175:assumed-role/eksctl-JohnDoeEKSK0rdentMgmtClus-NodeInstanceRole-j0olMRJHrM0A/i-0f7dad2d91447f173 is not authorized to perform: s3:ListBucket on resource: "arn:aws:s3:::nick-chase-backup-bucket" because no identity-based policy allows the s3:ListBucket action...you can extract the role from the message (in this example, it's the assumed-role) and create the policy. For example:
aws iam put-role-policy --role-name eksctl-JohnDoeEKSK0rdentMgmtClus-NodeInstanceRole-j0olMRJHrM0A --policy-name velero --policy-document file://velero-policy.jsonGenerate the necessary base64-encoded credentials using:
base64 -w0 credentials.txt; echoUse this base64 value in the
data.cloudfield in theSecretobject to be created by the next listing, also make sure to substitute the appropriateAWS-REGION-NAMEandBUCKET-NAME:kubectl create -f - << EOF --- apiVersion: v1 data: # base64-encoded credentials for Amazon S3 in the following format: # [default] # aws_access_key_id = EXAMPLE_ACCESS_KEY_ID # aws_secret_access_key = EXAMPLE_SECRET_ACCESS_KEY cloud: <BASE64_VALUE> kind: Secret metadata: name: cloud-credentials namespace: kcm-system type: Opaque --- apiVersion: velero.io/v1 kind: BackupStorageLocation metadata: name: aws-s3 namespace: kcm-system spec: config: region: <AWS-REGION-NAME> default: true # optional, if not set, then storage location name must always be set in ManagementBackup objectStorage: bucket: <BUCKET-NAME> provider: aws backupSyncPeriod: 1m credential: name: cloud-credentials key: cloud EOFFor the regional cluster case, do exactly this step on the regional cluster.
Note, that all of the management and regional cluster must have the same
BackupStorageLocationspecification with the same credentials. -
Confirm that the previous steps were applied correctly:
kubectl get managements kcm -o yaml kubectl get regions <region-name> -o yamlThe
managementorregionconfiguration yaml should have the new velero plugin details, as shown in step 2.Now make sure the
backupstoragelocationshows asAvailableon the management cluster (and regional cluster if applicable):kubectl get backupstoragelocation -n kcm-systemNAME PHASE LAST VALIDATED AGE DEFAULT aws-s3 Available 27s 2d true
You can get more information on how to build these objects at the official Velero documentation.