Error while doing kubernetes-init command

+2 votes

I'm trying to run the following command

sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.56.56 --ignore-preflight-errors=...

I get the following errors

[init] using Kubernetes version: v1.11.2
[preflight] running pre-flight checks
I0905 15:35:34.143850   32381 kernel_validator.go:81] Validating kernel version
I0905 15:35:34.144318   32381 kernel_validator.go:96] Validating kernel config
[preflight] Some fatal errors occurred:
 [ERROR Port-6443]: Port 6443 is in use
 [ERROR Port-10251]: Port 10251 is in use
[ERROR Port-10252]: Port 10252 is in use
 [ERROR FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml]: /etc/kubernetes/manifests/kube-apiserver.yaml already exists
 [ERROR FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml]: /etc/kubernetes/manifests/kube-controller-manager.yaml already exists
                [ERROR FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml]: /etc/kubernetes/manifests/kube-scheduler.yaml already exists
                [ERROR FileAvailable--etc-kubernetes-manifests-etcd.yaml]: /etc/kubernetes/manifests/etcd.yaml already exists
                [ERROR Port-10250]: Port 10250 is in use
                [ERROR Port-2379]: Port 2379 is in use
                [ERROR DirAvailable--var-lib-etcd]: /var/lib/etcd is not empty
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`

Whats the issue?

Sep 6, 2018 in Kubernetes by lina
• 8,110 points
3,231 views

3 answers to this question.

+1 vote
Best answer
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.
answered Sep 6, 2018 by Kalgi
• 42,540 points

selected Apr 26 by Omkar
+1 vote

Run docker ps -a | grep kube to find related container logs, such as apiserver. 

answered Apr 26 by Hitesh
+1 vote

Run kubeadm reset to revert any changes made to this host by kubeadm init. And try setting up the cluster again! This helped me :)

answered Apr 26 by Jobin

Hey thanks! That worked for me.

But now I have another error

The connection to the server x.x.x.x:8080 was refused - did you specify the right host or port?

when I do kubectl apply -f https://git.io/weave-kube

Related Questions In Kubernetes

0 votes
1 answer

oci runtime error while running kubernetes on rancher cluster

You need to switch Docker to 1.12.x; ...READ MORE

answered Sep 6, 2018 in Kubernetes by Kalgi
• 42,540 points
113 views
0 votes
1 answer

Error while installing Kubernetes using snap

Don't install using snap. It throws a ...READ MORE

answered Aug 6 in Kubernetes by Harshit
45 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
3,118 views
+3 votes
1 answer
0 votes
1 answer

Error while creating kubernetes dashboard

The installation fails because there is no ...READ MORE

answered Aug 27, 2018 in Kubernetes by Kalgi
• 42,540 points
438 views
0 votes
3 answers

Error while setting up kubernetes

echo "1" > /proc/sys/net/bridge/bridge-nf-call-iptables READ MORE

answered May 15 in Kubernetes by sivashankar
2,456 views