Move kubernetes (kubespray) nodes to another IP range

4/28/2020

I installed a kubernetes cluster by using kuberspray on my internal network, 192.168.0.0/24. Now I need more nodes and these nodes will be located on other networks. So I will set up a VPN between the current nodes and the new nodes.

The problem is that I cannot find any information specifically related to kubespray on how to change the internal IPs of the nodes in order to "move them on the VPN". I think after moving the nodes on the VPN, then it's just a matter of installing the new nodes in the cluster and I'm set.

So: Using kubespray (or manually if not possible via kubespray directly) how can I change the internal IPs of the nodes in order to move them on the VPN?

-- Paul
kubernetes
kubespray

1 Answer

4/28/2020

Kubespray supports kubeadm for cluster creation since v2.3 and deprecated non-kubeadm deployment starting from v2.8. I assume that you can use kubeadm with your Kubespray installation. I see two ways to achieve your goal. Both from Kubernetes side:

  1. By using ifconfig command:

    • run kubeadm reset on the node you want to reconfig

    • run ifconfig <network interface> <IP address>

    • run kubeadm join in order to add the node again with the new IP

  2. By editing the kubelet.conf file:

    • run systemctl status kubelet to find out the location of your kubelet.conf (usually /etc/kubernetes/kubelet.conf)

    • edit it by adding KUBELET_EXTRA_ARGS=--node-ip=<IP_ADDRESS>

    • run systemctl daemon-reload

    • run systemctl restart kubelet

Please let me know if that helped.

-- OhHiMark
Source: StackOverflow