Kubeadm init/join using public IP

5/1/2020

I am working on setting up a multi-node, multi hardware server Kubernetes Cluster. I am using Calico and Kubeadm.

The one server version is working on windows using a private network among the host machine.

I am facing a networking issue that I am trying to fix to connect nodes across the external network (LAN).

So I am trying to use a bridge adapter ‘a nic virtualization’ within the virtual machines (nodes) to allow visibility over the network to a remote server using promiscuous mode and a static IP address. I am using Vagrant.

But I cannot create a static public IP over the network (LAN), maybe I have don’t have the privilege to do it.

Troubleshooting:

  1. To start I’ve tried to create a random IP public address, it’s working. But when I tried to join the worker nodes to the master it failed using kubeadm, “connection refused”. Kubeadm join command works only on the private network, I read that there’s extra Kubernetes config to edit to allow the external access, but I couldn't figure out how to do it. I tried to use: kubeadm join <public-ip>:6443 --token wby3bb.vomsgxxxxxxb --discovery-token-ca-cert-hash sha256:xxxxx but the generated file /etc/kubernetes/bootstrapkubelet.conf and /etc/kubernetes/kubelet.conf is still using the :6443 inside it. I tried also to update --advertise-address.

  2. One of the ideas it to create a gateway to forward the traffic of a specific port from the first net interface to the second, I am using Ubuntu/xenial on the host machines.

  3. I think that the easiest solution, it to fix the traffic forwarding and the IP address allocation.

I am asking if someone could help me.

Thank you.

-- Zouari.M
kubeadm
kubernetes
networking

1 Answer

5/1/2020

While doing kubeadm init add the PUBLIC IP and PORT as part of --control-plane-endpoint parameter.

sudo kubeadm init --control-plane-endpoint "PUBLIC_IP:PORT"
-- Arghya Sadhu
Source: StackOverflow