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,220 points
24,611 views

3 answers to this question.

+4 votes
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.

If you are interested in knowing more about Kubernetes, then consider taking  CKA Certification Course.

answered Sep 6, 2018 by Kalgi
• 52,360 points

selected Apr 27, 2019 by Omkar
Issue not solved by above steps

kubeadm reset

systemctl restart kubelet
+1 vote

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

answered Apr 26, 2019 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, 2019 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
• 52,360 points
1,124 views
0 votes
1 answer

Error while installing Kubernetes using snap

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

answered Aug 6, 2019 in Kubernetes by Harshit
2,907 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17, 2019 in Others by anonymous
15,297 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,923 views
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
• 52,360 points
1,743 views
0 votes
3 answers

Error while setting up kubernetes

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

answered May 16, 2019 in Kubernetes by sivashankar
16,847 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP