基于RKE部署的k8s集群迁移

公司目前k8s管理环境太多,不方便管理,因此对k8s测试环境进行迁移,方便统一管理

本文适用于RKE部署的k8s集群,管理平台为rancher

整体情况如下

名称地址版本
目标平台https://k8s.example.comrancherv2.3.3
源平台https://rancher.example.comrancherv2.3.5

第一步  在目标平台添加k8s集群

进入目标平台--全局---添加集群--导入集群


接下来就是导入的参数,我们使用认证过的ssl证书,所以选择是第一种,点击右边的复制按钮

这里可以根据自己的情况选择是认证的还是私有的。

此时不要点击完成。等执行完命令后再回来点击完成

进入命令行执行

[rancher@xr-prelocus ~]$ kubectl apply -f https://k8s.example.com/v3/import/zwl5xnpqzcrcpncvwt9hlw79kv8slpbttqkx97jfqtg4zsjgrj5vv5.yaml
Warning: resource clusterroles/proxy-clusterrole-kubeapiserver is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
clusterrole.rbac.authorization.k8s.io/proxy-clusterrole-kubeapiserver configured
Warning: resource clusterrolebindings/proxy-role-binding-kubernetes-master is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
clusterrolebinding.rbac.authorization.k8s.io/proxy-role-binding-kubernetes-master configured
namespace/cattle-system unchanged
serviceaccount/cattle unchanged
Warning: rbac.authorization.k8s.io/v1beta1 ClusterRoleBinding is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 ClusterRoleBinding
clusterrolebinding.rbac.authorization.k8s.io/cattle-admin-binding unchanged
secret/cattle-credentials-f18579e created
clusterrole.rbac.authorization.k8s.io/cattle-admin unchanged
deployment.apps/cattle-cluster-agent configured
daemonset.apps/cattle-node-agent configured
[rancher@xr-prelocus ~]$ 

执行完毕后返回来页面点击完成

检查会发现只有两个项目

由于项目是在原来的平台上建的,并没有随着迁移过来,所以需要自己新建项目并把命名空间迁移至该项目上。

此时在新平台上已经能够正常显示了,

删除旧平台上的k8s集群

到此迁移完成。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值