How to move Kubernetes master node from one server to another?

7/23/2019

I have Kubernetes cluster with two nodes. One's role is Master.

I want to move master node to another physical server.

The possible way I see is to add another node and change its role to master.

How can I do that? Is there any kind of instructions? Is this the only way?

-- Alexey Anisimov
kubeadm
kubernetes

1 Answer

7/24/2019

Might be a duplicate of Migration of Kubernetes Master

In fact, you just need to

  • clone data from the disk
  • change identity of the new server (IP address/DNS name)

Update

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

  • 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)

Or take a look at this step-by-step instruction

-- A_Suh
Source: StackOverflow