velero
一、制作velero镜像push到镜像仓库(Velero默认镜像源是docker ,无法直接访问,因此使用国内加速资源;
- 安装docker
配置仓库源
sudo yum-config-manager
–add-repo
https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
安装Docker Engine
sudo yum install docker-ce docker-ce-cli containerd.io
systemctl enable docker
systemctl start docker
[图片]
配置国内镜像
创建目录
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-‘EOF’
{
“registry-mirrors”: [
“http://hub-mirror.c.163.com”,
“https://mirrors.tuna.tsinghua.edu.cn”,
“http://mirrors.sohu.com”,
“https://ustc-edu-cn.mirror.aliyuncs.com”,
“https://ccr.ccs.tencentyun.com”,
“https://docker.m.daocloud.io”,
“https://docker.awsl9527.cn”
]
}
EOF
重新加载配置
systemctl daemon-reload
重启Docker
systemctl restart docker
拉取velero镜像到本地
将镜像推送到镜像仓库
docker login --username=8418*****@qq.com crpi-szraq415k2nt3drs.cn-beijing.personal.cr.aliyuncs.com
docker tag [ImageId] crpi-szraq415k2nt3drs.cn-beijing.personal.cr.aliyuncs.com/vele/bhs-ts:[镜像版本号]
docker push crpi-szraq415k2nt3drs.cn-beijing.personal.cr.aliyuncs.com/vele/bhs-ts:[镜像版本号]
bhs-ts 仓库名称
vele 命名空间
velero部署安装
前提条件:k8s需要可以访问公网
[图片]
下载安装velero客户端
wget https://github.com/vmware-tanzu/velero/releases/download/v1.14.0/velero-v1.14.0-linux-amd64.tar.gz
tar xvf velero-v1.14.0-linux-amd64.tar.gz
cp ./velero-v1.14.0-linux-amd64/velero /usr/local/bin
验证Velero 版本
velero version
创建备份对象存储子账号访问密钥文件credentials-velero
vim credentials-velero
[default]
aws_access_key_id = {AK}
aws_secret_access_key = {SK}
部署Velero服务端
velero install --provider aws --plugins crpi-szraq415k2nt3drs.cn-beijing.personal.cr.aliyuncs.com/vele/bhs-ts:v1.9.0
–bucket bhs-test
–secret-file ./credentials-velero
–image crpi-szraq415k2nt3drs.cn-beijing.personal.cr.aliyuncs.com/vele/bhs-ts:v1.14.0
–use-volume-snapshots=false
–backup-location-config
region=cn-guangzhou,s3Url=https://tos-s3-cn-guangzhou.volces.com
Velero实例将默认创建一个名为velero的namespace,执行以下命令可查看pod状态。
kubectl get pods -n velero
创建备份
velero backup create backup-name --include-namespaces namespace
查看备份情况:
velero backup get
velero backup describe test-1 --details 命令,查看详细的备份数据清单。
使用Velero工具创建restore,指定名称为test-1的备份
velero restore create --from-backup test-1
可通过velero restore get语句查看应用恢复情况。
从备份恢复
velero restore get