
velero 是备份和还原kubernetes集群资源的和持久卷的工具, 主要提供了以下功能:
tke官方文档中以及有了velero的最佳实践(https://cloud.tencent.com/document/product/457/50122),本篇文章是在原官方文档中内的补充,针对velero-plugin-for-tencent 插件的使用.
Velero 工作原理图如下图所示(来源于 Velero 官网),当用户执行备份命令时,备份过程说明如下:

本次测试使用cos作为存储创建cos存储

TENCENT_CLOUD_SECRETID=<SecretId>
TENCENT_CLOUD_SECRETKEY=<SecretKey>brew install velero1. wget https://github.com/vmware-tanzu/velero/releases/download/v1.5.2/velero-v1.5.2-linux-amd64.tar.gz
2. tar -xvf velero-v1.5.2-linux-amd64.tar.gz
3. mv velero-v1.5.2-linux-amd64/velero /usr/bin/先设置环境变量:
BUCKET=<YOUR_BUCKET>
REGION=<YOUR_REGION>执行一下命令进行部署:
velero install \
--provider tencentcloud \
--plugins ccr.ccs.tencentyun.com/ruiqingzhu-tke/velero-plugin-for-tencentcloud:v1 \
--bucket $BUCKET \
--secret-file ./credentials-velero \
--default-volumes-to-restic --use-restic --backup-location-config region=$REGION,insecureSkipTLSVerify="true"安装过程如下:

添加环境变量:
kubectl set env deployment/velero TENCENT_CREDENTIALS_FILE=/credentials/cloud -n velero
测试场景从A集群迁移到B集群
velero backup create cluster-a --exclude-namespaces=velero,kube-system,kube-node-lease查看备份状态:
velero backup get cluster-a
Status为Completed 表明备份结束。
➜ velero_test velero restore create cluster-b --from-backup cluster-a --kubeconfig kubeconf-b.config
Restore request "cluster-b" submitted successfully.
Run velero restore describe cluster-b or velero restore logs cluster-b for more details.
# 查看迁移时是否有错误的还原信息
velero restore logs <BACKUP-NAME> | grep error
# 查看迁移时跳过的还原操作
velero restore logs <BACKUP-NAME> | grep skip使用一下命令查看迁移过后的集群应用信息:
kubectl get po --all-namespace如果部分有问题,需要进步排查,可能需要手动调整。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。