Velero Plugin for Alibaba Cloud is a plugin for using Velero to backup and restore Kubernetes resources on Alibaba Cloud.
Current Version: v2.0.0 (for Velero v1.17.x)
Velero is a utility to back up and restore your Kubernetes resource and persistent volumes.
To do backup/restore on Alibaba Cloud through Velero utility, you need to install and configure velero and velero-plugin-for-alibabacloud.
To set up Velero on Alibaba Cloud, you:
- Create your OSS bucket
- Configure authorization
- Install Velero and velero-plugin-for-alibabacloud
Velero requires an object storage bucket to store backups in, preferably unique to a single Kubernetes cluster.
Please refer to the Create a bucket documentation to create an OSS bucket.
Velero needs permissions to access Alibaba Cloud OSS and ECS services. You can choose one of the following two authorization methods:
This option is suitable for scenarios where Velero runs on Alibaba Cloud ECS nodes, and is recommended for ACK clusters.
Prerequisites: Compute nodes are Alibaba Cloud ECS instances.
-
Configure Worker RAM Role:
- If you are using Alibaba Cloud ACK, the cluster nodes are already bound to a RAM role with empty permissions by default, so you can skip this step. To refine the Worker RAM role for different nodes, you can refer to the Use Custom Worker RAM Roles documentation to customize Worker RAM roles.
- Otherwise, you should create a RAM role and bind it to the ECS nodes where Velero runs. Refer to the Attach an Instance RAM Role to an ECS Instance documentation.
-
Create a custom policy:
Follow the Create a custom policy documentation to create a policy with the following content:
{ "Version": "1", "Statement": [ { "Action": [ "ecs:DescribeSnapshots", "ecs:CreateSnapshot", "ecs:DeleteSnapshot", "ecs:DescribeDisks", "ecs:CreateDisk", "ecs:Addtags", "oss:PutObject", "oss:GetObject", "oss:DeleteObject", "oss:GetBucket", "oss:ListObjects", "oss:ListBuckets" ], "Resource": [ "*" ], "Effect": "Allow" } ] } -
Grant permissions to the RAM role:
Follow the Grant permissions to a RAM role documentation to grant the above policy to the RAM role.
-
Create a Velero-specific credentials file:
Create a Velero credentials file (
credentials-velero) in yourinstalldirectory:ALIBABA_CLOUD_RAM_ROLE=<RAM_ROLE_NAME>where
RAM_ROLE_NAMEis the RAM role name configured in step 1.
This option is suitable for non-ECS environments or scenarios requiring finer-grained control.
-
Create the RAM user:
Follow the Create a RAM user documentation.
-
Create a custom policy:
Follow the Create a custom policy documentation to create a policy with the following content:
{ "Version": "1", "Statement": [ { "Action": [ "ecs:DescribeSnapshots", "ecs:CreateSnapshot", "ecs:DeleteSnapshot", "ecs:DescribeDisks", "ecs:CreateDisk", "ecs:Addtags", "oss:PutObject", "oss:GetObject", "oss:DeleteObject", "oss:GetBucket", "oss:ListObjects", "oss:ListBuckets" ], "Resource": [ "*" ], "Effect": "Allow" } ] } -
Grant permissions to the RAM user:
Follow the Grant permissions to the RAM user documentation to grant the above policy to the RAM user.
-
Create an access key for the user:
Follow the Create an AccessKey pair documentation to create an AccessKey for the RAM user.
-
Create a Velero-specific credentials file:
Create a Velero credentials file (
credentials-velero) in yourinstalldirectory:ALIBABA_CLOUD_ACCESS_KEY_ID=<ALIBABA_CLOUD_ACCESS_KEY_ID> ALIBABA_CLOUD_ACCESS_KEY_SECRET=<ALIBABA_CLOUD_ACCESS_KEY_SECRET>where the access key id and secret are the values from step 4.
Download the latest official release's tarball for your client platform.
Run the following command to install Velero and velero-plugin-for-alibabacloud into the cluster. This will create a namespace called velero, and place a deployment named velero in it.
velero install \
--provider alibabacloud \
--image registry-cn-hangzhou.ack.aliyuncs.com/acs/velero:v1.17.1\
--plugins registry-cn-hangzhou.ack.aliyuncs.com/acs/velero-plugin-alibabacloud:v2.0.0-eaad098 \
--bucket <YOUR_BUCKET> \
--secret-file ./credentials-velero \
--backup-location-config region=<REGION>,network=<NETWORK> \
--snapshot-location-config region=<REGION> \
--wait| Parameter | Type | Description | Example |
|---|---|---|---|
region |
Required | The region where the OSS bucket is located | cn-hangzhou |
network |
Optional | Network type. Options: internal (internal network), accelerate (accelerate domain). Default is public network |
internal |
endpoint |
Optional | Custom OSS endpoint | https://oss-custom.example.com |
| Parameter | Type | Description | Example |
|---|---|---|---|
region |
Required | The region where ECS snapshots are located | cn-hangzhou |
| Parameter | Type | Description | Example |
|---|---|---|---|
--prefix |
Optional | Used to store backups from multiple clusters in the same bucket, specifies the path prefix in the OSS bucket | cluster1 |
(Optional) Customize the Velero installation further to meet your needs.
To uninstall Velero, please refer to the Velero official uninstall documentation.