2

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 !

  • If I understood correctly, you want to change the node IP. This column display the nodes IPs, so you need to change the IP in your OS and re-join the nodes again, because Kubernetes doesn't manage this IPs. Could you confirm if I understood correctly, and if not give more details about or issue? – Mr.KoopaKiller Mar 16 '20 at 08:36
  • No. I shutdown all the servers and now I have new ip's (- even for the master itself.). And the master dosn't success even to show the nodes. As, it tell me that it tries to connect to the previous master ip. – Sara Ben Shabbat Mar 16 '20 at 16:23
  • To use a Kubernets cluster you need first of all configure your nodes with static IP, and them make the k8s installation. Do you performed this steps before install the cluster? – Mr.KoopaKiller Mar 17 '20 at 08:11
  • No. So, As I understand the only one option is to reinstall ?! – Sara Ben Shabbat Mar 17 '20 at 17:01

1 Answers1

1

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/