kubeadm init command failing on ubuntu master node

4/30/2020

kubeadm init --apiserver-advertise-address=192.168.56.103 --pod-network-cidr=192.168.0.0/16

getting following error

W0501 02:23:32.828806    8629 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
[init] Using Kubernetes version: v1.18.2
[preflight] Running pre-flight checks
    [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR Port-10259]: Port 10259 is in use
    [ERROR Port-10257]: Port 10257 is in use
    [ERROR Port-10250]: Port 10250 is in use
    [ERROR Port-2380]: Port 2380 is in use
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
-- Yogesh Bombe
kubernetes

1 Answer

4/30/2020
[ERROR Port-10259]: Port 10259 is in use
[ERROR Port-10257]: Port 10257 is in use
[ERROR Port-10250]: Port 10250 is in use
[ERROR Port-2380]: Port 2380 is in use

Above error shows ports are in use.

In kubernetes

  • 10259 => default port for kube-scheduler
  • 10257 => default port for kube-controller-manager
  • 10250 => default port for kubelet
  • 2380 => etcd use this

It seems kubeadm init was already called on this node. Run kubeadm reset before running kubeadm init command.

If that does not work for you then you can check which process using those port by running

netstat -lnp | grep 1025

and you can kill those port by running

sudo fuser -k <port>/tcp
-- hoque
Source: StackOverflow