How to use kubeadm to create kubernetes cluster?

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.


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