Kubernetes set a custom node-ip
by Alex Arica

By default, Kubernetes uses the network interface of the default gateway to defines a node-ip.

We can find the default gateway as follows:

ip route

Output example:

default via dev eth0 ....

The example above shows the default gateway's interface is "eth0". When installing Kubernetes, the installer would use the network interface "eth0" to configure Kubernetes' node-ip.

Set a custom node-ip

After the installation of Kubernetes, it is still possible to change the node-ip.

Open the file:

sudo vi /etc/systemd/system/kubelet.service.d/10-kubeadm.conf


--node-ip=[desired IP address for node-ip]

Restart kubelet

sudo systemctl daemon-reload
sudo systemctl restart kubelet

If we list the Kubernetes nodes, we will see the custom IP that we set above.

Additional readings:

How to specify Internal-IP for kubernetes worker node