How to change the k8s internal ip addresses?

I provisioned a kubernetes cluster on my own couple of virtual machines via kubespray.
The VM's network is bridged adapter and kubespray uses calico as default network-plugin.

Before sometime, I've switched to another network and as a result of the router change, the internal IP addresses have been changed.

When I run kubectl get nodes on the master node I get -
Unable to connect to server : dial tcp <master previous IP>:6443: connect: network is unreachable
In addition, the vm doesn't generate a new ip for the machine (- from the current router.).

My question is, How can I change the ip's of the nodes ?

Attached is the screenshot of my laptop that shows the k8s nodes and the column I wish to edit.
(- The screenshot is fro when I've been connected to the network via the previous router.)

enter image description here

Thanks in advance for any help !


The collumn INTERNAL-IP show your nodes IPs, Kubernetes doesn't manage this IP's.

Is recommended configure static IP for all your nodes before setup your Kubernetes cluster to avoid problems like this.

I see 2 alternatives:

  1. Set static ip displayed in INTERNAL-IP on your nodes, for examples:

Your kubectl get nodes show node2 with ip 192.168.43.118, so in node2 you need to configure this ip and reboot the node. The same step for all nodes.

How to configure static ip on Ubuntu

How to configure static ip on CentOS

  1. Edit the --node-ip in kubelet config on the node for the new IP, see this reference.

References:

https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/