How to use kubeadm to create kubernetes cluster?

1/19/2017

I init k8s cluster master with kubeadm, but I felt very confused. The version of kubeadm:

# ./kubeadm version
kubeadm version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1", GitCommit:"82450d03cb057bab0950214ef122b67c83fb11df", GitTreeState:"clean", BuildDate:"2016-12-14T00:52:01Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}

When I run command with kubeadm init, told me must start kubelet.service:

# ./kubeadm init
Running pre-flight checks
preflight check errors:
    kubelet service is not active, please run 'systemctl start kubelet.service'

And then When I retry this command after systemctl restart kubelet.service, told me Port 10250 in use:

# systemctl restart kubelet.service
# ./kubeadm init
Running pre-flight checks
preflight check errors:
    Port 10250 is in use
    /var/lib/kubelet is not empty

Is there any way to run kubelet with no port OR can I change the port of kubelet?

-- sope
kubeadm
kubernetes

4 Answers

1/19/2017

You can use --port <port number> to override the port number for kublet.

For more information refer this: https://kubernetes.io/docs/admin/kubelet/

-- Rama Boggarapu
Source: StackOverflow

5/23/2017

The reason that it mentions the port is in use is because you already ran kubeadm init once and it has already changed a number of things.

run kubeadm reset first to undo all of the changes from the first time you ran it.

Then run systemctl restart kubelet

Finally, when you run kubeadm init you should no longer get the error.

Any time kubeadm does something that's not right or otherwise fails, it needs to be reset to work properly again.

-- jzeef
Source: StackOverflow

10/24/2017

Check the process which uses Port 10250,

sudo netstat -lnp | grep 10250

Kill the process using

sudo kill Process_PID

then run kubeadm init .

-- snehal
Source: StackOverflow

12/10/2019

I also had same problem.

error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR Port-10251]: Port 10251 is in use
    [ERROR Port-10252]: Port 10252 is in use
    [ERROR Port-10250]: Port 10250 is in use
    [ERROR Port-2380]: Port 2380 is in use

then i noticed that there is another process is running "microk8s" once I stopped that, I was able to start kubeadm

sudo microk8s.stop
-- Hasitha
Source: StackOverflow