This plugin is used for saving and retrieving backup data on Huawei Cloud OBS as an object storage plugin. The backup includes metadata files of Kubernetes resources and CSI objects, as well as the progress of asynchronous operations. It is also used to store result data from backups and restores, including log files, warning/error files, and more.
- CCE cluster
- Git
- Docker
- Docker-buildx
-
Log in to a node in the CCE cluster and connect to the cluster.
-
Install the Velero CLI tool.
Download
velero-v1.15.0-linux-amd64.tar.gz
from the official website and upload it to the node.Extract Velero:
tar -xvf velero-v1.15.0-linux-amd64.tar.gz mv velero-v1.15.0-linux-amd64/velero /usr/local/bin/velero
-
Build the Velero plugin image.
Clone the Velero plugin repository:
git clone https://github.com/setoru/velero-plugin-for-huaweicloud.git
Build the image:
cd velero-plugin-for-huaweicloud make container
-
Create a new OBS bucket. The bucket should not contain other directories.
-
Create a credentials configuration file.
mkdir velero vi /home/velero/credentials-velero
Add the following content:
OBS_ACCESS_KEY=<Your AK> OBS_SECRET_KEY=<Your SK>
-
Install Velero using the CLI tool.
velero install \ --provider huawei.com/huaweicloud \ --plugins swr.ap-southeast-1.myhuaweicloud.com/huaweiclouddeveloper/velero-plugin-for-huaweicloud:v1.0.0 \ --bucket <Your Bucket> \ --secret-file /home/velero/credentials-velero \ --backup-location-config \ endpoint=<Your Endpoint>
Replace
<Your Bucket>
and<Your Endpoint>
with your bucket name and endpoint.Enter the CCE cluster, upgrade the Velero workload, replace the image with the one uploaded to SWR, and add the environment variable
HUAWEI_CLOUD_CREDENTIALS_FILE=/credentials/cloud
. -
Check the storage location status.
velero backup-location get
available
indicates a successful installation. -
Backup data.
Backup all resources in the
default
namespace:velero backup create default-backup --include-namespaces default
Check if the backup was successful:
velero backup get
completed
indicates the backup was successful.View details and logs:
velero backup describe default-backup velero backup logs default-backup
-
Delete resources in the
default
namespace. -
Restore resources.
Update the backup storage location to read-only mode:
kubectl patch backupstoragelocation default \ --namespace velero \ --type merge \ --patch '{"spec":{"accessMode":"ReadOnly"}}'
Restore resources using the created backup:
velero restore create --from-backup default-backup
Check the restore status:
velero restore get
completed
indicates a successful restore.Restore the backup storage location to read-write mode:
kubectl patch backupstoragelocation default \ --namespace velero \ --type merge \ --patch '{"spec":{"accessMode":"ReadWrite"}}'
-
Delete a backup.
velero backup delete default-backup
-
Uninstall Velero resources.
kubectl delete namespace/velero clusterrolebinding/velero kubectl delete crds -l component=velero