Kubernetes 备份工具——velero 的使用:
0. wget https://github.com/heptio/velero/releases/download/v1.0.0/velero-v1.0.0-darwin-amd64.tar.gz
1. install the velero client:
brew install velero
2. Create a Velero-specific credentials file (credentials-velero):
cat>> credentials-velero<<EOF
[default]
aws_access_key_id = minio
aws_secret_access_key = minio123
EOF
3. Start the server and the local storage service. In the Velero directory, run:
kubectl apply -f examples/minio/00-minio-deployment.yaml
velero install --provider aws --bucket velero --secret-file ./credentials-velero --use-restic --use-volume-snapshots=true --image jessestuart/velero:v1.0.0 --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://10.7.10.36:9000
4. Add annotate for pod pvc:
kubectl -n mytest annotate pod/mongodb-0 backup.velero.io/backup-volumes=mongo-data
kubectl -n mytest annotate pod/console-758467d7db-jws42 backup.velero.io/backup-volumes=console-file
kubectl -n mytest annotate pod/gateway-6b4cb7dfcd-rrz7n backup.velero.io/backup-volumes=gateway-file
kubectl -n mytest annotate pod/nodered-56f6c4dd68-fv7ln backup.velero.io/backup-volumes=nodered-data
5. 更换默认的velero-restic-restore-helper 镜像:
cat > velero-helper.yaml <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: restic-restore-action-config
namespace: velero
labels:
velero.io/plugin-config: ""
velero.io/restic: RestoreItemAction
data:
image: jessestuart/velero-restic-restore-helper:v1.0.0
EOF