Kubeadm init fails when I use –apiserver-advertise-address

kubeadmkubernetes

I am Installing a standalone Kubernetes cluster (kubeadm version is 1.14) on RHEL 7.7 Operating System. I have a Load Balancer (Private LB with a private IP address) configured for my Kubernetes master node. When I issued the command

kubeadm init --apiserver-advertise-address=<IP Address of the LB>

I got the below error:

Unable to register node "master node name" with API Server. write tcp "IP address of masternode":<52444>–"IP address of LB":6443. Connection reset by peer.

If I issue only kubeadm init, the command successfully initiates the cluster.

Also, If I use the DNS of the LB and try to create a multi-plane cluster (using controlPlaneEndpoint as DNS of the LB), that also works. Any idea on why it fails with the --apiserver-advertise-address?

Also, what if I use the method of creating a multi-plane cluster (controlPlaneEndpoint) but use the cluster that is built as a standalone cluster? (i.e., not adding any further master nodes). Will it cause any issues?

Best Answer

If I understand your use case correctly this might not be possible.

apiserver-advertise-address is being used to set the node interface in which the api-server will bind. Therefore, you can't bind to LB interface because it is not an actual interface. Official source:

(Optional) Unless otherwise specified, kubeadm uses the network interface associated with the default gateway to set the advertise address for this particular control-plane node's API server. To use a different network interface, specify the --apiserver-advertise-address=<ip-address> argument to kubeadm init. To deploy an IPv6 Kubernetes cluster using IPv6 addressing, you must specify an IPv6 address, for example --apiserver-advertise-address=fd00::101

While --apiserver-advertise-address can be used to set the advertise address for this particular control-plane node's API server, --control-plane-endpoint can be used to set the shared endpoint for all control-plane nodes.

Related Topic