Kubeadm Setting up cluster on AWS

7/19/2019

I am trying to setup the kubernetes cluster on the AWS. I install the docker, kubelet, kubectl and kubeadm.

I have create 3 EC2 instances and assigned a Elastic IP to one VM.

On the Master node (having the Elastic IP), I run the following command:

sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=3.18.117.205

During the init process it stuck at the initialisation and returns the timeout error. Following are the logs of the Kubelet:

Jul 19 05:11:29 ip-172-31-16-195 kubelet[17171]: E0719 05:11:29.511349   17171 reflector.go:125] k8s.io/kubernetes/pkg/kubelet/config/apiserver
Jul 19 05:11:29 ip-172-31-16-195 kubelet[17171]: E0719 05:11:29.513005   17171 reflector.go:125] k8s.io/kubernetes/pkg/kubelet/kubelet.go:453: 
Jul 19 05:11:29 ip-172-31-16-195 kubelet[17171]: E0719 05:11:29.516066   17171 reflector.go:125] k8s.io/client-go/informers/factory.go:133: Fai
Jul 19 05:11:29 ip-172-31-16-195 kubelet[17171]: E0719 05:11:29.537776   17171 reflector.go:125] k8s.io/kubernetes/pkg/kubelet/kubelet.go:444: 
Jul 19 05:11:29 ip-172-31-16-195 kubelet[17171]: E0719 05:11:29.601084   17171 kubelet.go:2248] node "ip-172-31-16-195" not found
Jul 19 05:11:29 ip-172-31-16-195 kubelet[17171]: E0719 05:11:29.701293   17171 kubelet.go:2248] node "ip-172-31-16-195" not found
Jul 19 05:11:29 ip-172-31-16-195 kubelet[17171]: E0719 05:11:29.801496   17171 kubelet.go:2248] node "ip-172-31-16-195" not found
Jul 19 05:11:29 ip-172-31-16-195 kubelet[17171]: E0719 05:11:29.901732   17171 kubelet.go:2248] node "ip-172-31-16-195" not found
Jul 19 05:11:30 ip-172-31-16-195 kubelet[17171]: E0719 05:11:30.001992   17171 kubelet.go:2248] node "ip-172-31-16-195" not found
Jul 19 05:11:30 ip-172-31-16-195 kubelet[17171]: E0719 05:11:30.102215   17171 kubelet.go:2248] node "ip-172-31-16-195" not found

If i use the following command:

sudo kubeadm init --pod-network-cidr=10.244.0.0/16

Then the initialisation is successfully done and I get the command to join the network.

The join command contains the Private IP address of the VM.

So if I use the above join command and creates the cluster with it then if in any case, I reboot the master node, then will it effect the cluster like change in the Private IP of the machine?

If not, then what is the use of Elastic IP?

Any help, will be really appreciated.

Thanks

-- Sahil
amazon-web-services
docker
kubeadm
kubelet
kubernetes

1 Answer

9/29/2019

I reboot the master node, then will it effect the cluster like change in the Private IP of the machine?

Rebooting an EC2 instance does not change the private IP address of the instance; it only changes the public address (unless it's an Elastic IP).

So you don't have to worry. And you don't need the Elastic IP to advertise the apiserver to the rest of the nodes in the cluster. In fact, you want the instances communicating over private IP as a matter of best practices.

If not, then what is the use of Elastic IP?

There is no use. Did a setup guide tell you that you need an Elastic IP?

I couldn't tell you more about why the Elastic IP is causing issues without knowing more about your network setup.

You could try to re-run kubeadm init with logging verbosity turned up -v=2 and post the output here if you want further help on troubleshooting.

Or you could try using the --apiserver-cert-extra-sans=<public ip address> instead of --apiserver-advertise-address

-- erstaples
Source: StackOverflow