1

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?

kenlukas
  • 2,886
  • 2
  • 14
  • 25
ILearn
  • 11
  • 1
  • 3
  • 1
    Looks like the kubelet cannot connect to api-server. Could you please try to set `--apiserver-advertise-address=0.0.0.0` and show us the results? – Wytrzymały Wiktor Aug 04 '20 at 09:28
  • The kubeadm init command works fine when using --apiserver-advertise-address=0.0.0.0. However, this command would take the IP address of the machine of the master node populate the same in the kubeadm join output. In my case, i would like to use the Load balancer configured on top of the master node. One more query on the same lines, what would be the drawbacks if spin up the cluster with the process followed for spinning up a HA cluster but limit to only single master node i.e. issue kubeadm init with controlPlaneEndpoint as DNS of the Load Balancer but do not add any further master node. – ILearn Aug 04 '20 at 17:22
  • Hey Kubernetes experts, Any insights would be helpful – ILearn Aug 06 '20 at 15:03

1 Answers1

1

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.

  • " --control-plane-endpoint can be used to set the shared endpoint for all control-plane nodes." I guess this is for a HA configuration because in a standalone cluster we will not have "all control-plane nodes" rather we would have single k8s master.As soon as we use -control-plane-endpoint we are effectively configuring a cluster where multiple control plan members can be joined. Its puzzling , there has to be a better way to build a single kubernetes master cluster where the master under is sitting under a LB.https://stackoverflow.com/questions/54037954/networking-in-kubernetes says we can – ILearn Aug 07 '20 at 14:40
  • @ILearn Sorry for the late response. Have you managed to make it work? – Wytrzymały Wiktor Aug 24 '20 at 11:47
  • Unfortunately not. I am still trying to figure out or find a reliable documentation that suggests how to put a single master behind a load balancer in Standalone cluster – ILearn Aug 25 '20 at 14:51