12

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?

4

5 回答 5

32

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.

于 2017-05-23T18:54:56.733 回答
8

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
于 2019-12-10T17:30:44.997 回答
6

Check the process which uses Port 10250,

sudo netstat -lnp | grep 10250

Kill the process using

sudo kill Process_PID

then run kubeadm init .

于 2017-10-24T08:57:38.270 回答
1

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

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

于 2017-01-19T04:03:22.313 回答
0

Make sure that kubelet is not installed twice.

Remove it from snap:

snap remove kubelet
于 2021-06-06T13:52:49.257 回答