且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Kubernetes主节点从一台服务器移动到另一台服务器?

更新时间:2022-05-18 07:00:08

可能是迁移的副本Kubernetes Master

实际上,您只需要

  • 从磁盘克隆数据
  • 更改新服务器的身份(IP地址/DNS名称)

更新

如果要在kubeadm配置中更改主IP地址,请检查以下参考:

If you want to change master IP address in kubeadm config, check following references:

  • 替换/etc/kubernetes中所有配置文件中的IP地址
  • 备份/etc/kubernetes/pki
  • 识别/etc/kubernetes/pki中具有旧IP地址作为替代名称的证书
  • 同时删除它们的证书和密钥(对我来说,这只是apiserver和etcd/peer)
  • 使用kubeadm alpha阶段证书重新生成证书 2
  • 在引用旧IP的kube-system命名空间中标识configmap
  • 手动编辑这些配置映射 重新启动kubelet和docker(强制重新创建所有容器)
  • replacing the IP address in all config files in /etc/kubernetes
  • backing up /etc/kubernetes/pki
  • identifying certs in /etc/kubernetes/pki that have the old IP address as an alt name
  • deleting both the cert and key for each of them (for me it was just apiserver and etcd/peer)
  • regenerating the certs using kubeadm alpha phase certs2
  • identifying configmap in the kube-system namespace that referenced the old IP
  • manually editing those configmaps restarting kubelet and docker (to force all containers to be recreated)

或者逐步查看说明href ="https://github.com/kubernetes/kubeadm/issues/338#issuecomment-418879755" >