linux 从自建k8s向托管EKS迁移

葫芦的运维日志

下一篇 搜索 上一篇

浏览量 2892

2021/06/04 17:00


从自建k8s向托管EKS迁移

Migration from self-built k8s to hosted EKS

A: 代表自建k8s

B: 代表托管k8s

A: Stands for self-built K8S

B: Stands for managed k8s

A 上操作:

Operation on A:

  • 下载velero
  • download velero
curl -sSL -o velero-v1.3.1-darwin-amd64.tar.gz https://github.com/vmware-tanzu/velero/releases/download/v1.3.1/velero-v1.3.1-darwin-amd64.tar.gz
  • 安装velero
  • install velero
./velero install --provider aws --plugins velero/velero-plugin-for-aws:v1.0.0 --bucket eks-dev-velero --secret-file ~/.aws/credentials-velero --backup-location-config region=cn-north-1 --snapshot-location-config region=cn-north-1

--snapshot-location-config 卷快照位置的配置。 格式是key1=value1,key2=value2

--backup-location-config 用于备份存储位置的配置。格式是key1=value1,key2=value2

--snapshot-location-config Configuration of the snapshot location of the volume.
Format is key1 = value1, key2 = value2
--backup-location-config is used to backup the configuration of the storage location. Format is key1 = value1, key2 = value2

  • 配置 aws s3 认证
  • Configure AWS S3 authentication

cat ~/.aws/credentials-velero

格式如下,只认小写

Format is as follows,Only lowercase

[default]
aws_access_key_id=****************3BB
aws_secret_access_key=******************pUk7A
aws_session_token=********************************==
region=cn-north-1
./velero backup create wangzi-bak --include-namespaces wangzi
./velero create backup eureka-bak-0603 --selector app=wangzi-discovery
./velero create backup nginx-ingress-bak-0603 --include-namespaces nginx-ingress

查看备份
Check the backup

./velero get backup

B 上操作:

Operation on B:

  • 下载velero
  • download velero
  • 安装velero
  • install velero
  • 配置 aws s3 认证
  • Configure AWS S3 authentication

以上操作同A

  • 恢复
  • restore
velero restore create --from-backup wangzi-bak
velero restore create --from-backup eureka-bak-0603
velero restore create --from-backup nginx-ingress-bak-0603

velero 卸载

velero uninstall 

验证
check

kubectl get pods --all-namespaces
kubectl get service -n wangzi

最好做全局备份,如果只做部分备份恢复相对比较麻烦会有很多地方要做修改,这里不做赘述,请自行研究.

It is better to do global backup. If you only do partial backup, it is relatively troublesome to restore. There will be a lot of changes to be made.

葫芦的运维日志

打赏

上一篇 搜索 下一篇
© 冰糖葫芦甜(bthlt.com) 2021 王梓打赏联系方式 陕ICP备17005322号-1