Error while joining cluster with node

0 votes

Hi Getting below error

Followed below url

https://www.edureka.co/blog/install-kubernetes-on-ubuntu#NodesJoiningKubeCluster

kube-master@kmaster:~$ sudo kubeadm join 172.30.250.79:6443 --token kakyg6.pgmm8emntyokc2pr --discovery-token-ca-cert-hash sha256:73dc55339c3210f611886daf9de92632e66d861799f4cb113c42b5782cf8a5a9
[preflight] Running pre-flight checks
[preflight] Some fatal errors occurred:
        [ERROR DirAvailable--etc-kubernetes-manifests]: /etc/kubernetes/manifests is not empty
        [ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists
        [ERROR Port-10250]: Port 10250 is in use
        [ERROR FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
Jan 11, 2019 in Others by vishal
14,523 views
Hey @Vishal, check if all your pods are running before trying to join the nodes.
Hi Kalgi.

Now i am getting below error after running sudo kubeadm join 172.30.250.79:6443 --token kakyg6.pgmm8emntyokc2pr --discovery-token-ca-cert-hash sha256:73dc55339c3210f611886daf9de92632e66d861799f4cb113c42b5782cf8a5a9 --ignore-preflight-errors=All

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] Trying to connect to API Server "172.30.250.79:6443"

[discovery] Created cluster-info discovery client, requesting info from "https://172.30.250.79:6443"

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

[discovery] abort connecting to API servers after timeout of 5m0s

couldn't validate the identity of the API Server: abort connecting to API servers after timeout of 5m0
sudo kubeadm join 172.30.250.79:6443 --token kakyg6.pgmm8emntyokc2pr --discovery-token-ca-cert-hash sha256:73dc55339c3210f611886daf9de92632e66d861799f4cb113c42b5782cf8a5a9

[sudo] password for kube-node:

[preflight] Running pre-flight checks

[preflight] Some fatal errors occurred:

    [ERROR FileAvailable--etc-kubernetes-bootstrap-kubelet.conf]: /etc/kubernetes/bootstrap-kubelet.conf already exists

    [ERROR FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists

[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`

Hey, seems like your token has expired, why don't you try creating another token for master?

[discovery] Failed to connect to API Server "172.30.250.79:6443": token id "kakyg6" is invalid for this cluster or it has expired. Use "kubeadm token create" on the master node to creating a new valid token

Also, you're getting the following error because you've already executed the join command on your nodes. Its created your  /etc/kubernetes/pki/ca.crt file even though your node failed to join. 

To get rid of this error, execute the following reset command on your node and execute then join command again. This will reset your cluster environment and then when you try joining the node again to the cluster, it will create all the files again.

kubeadm​ reset 

3 answers to this question.

0 votes
Hi Any update?
answered Jan 16, 2019 by anonymous
Hey, I've replied to your comment.

https://www.edureka.co/community/35422/error-while-joining-cluster-with-node%26show%3D35753?show=35753#c35753​

Please have a look and let me know of your cluster's further situation.
0 votes

To create a new token for master, use the command

kubeadm token create

Creating a new token for master is explained in this thread

https://www.edureka.co/community/35767/node-unable-to-join-cluster-saying-token-expired

answered Jan 16, 2019 by Layla
0 votes

Hi Kalgi after following above steps it works but unfortunately, it is giving me below error.

The connection to the server 172.30.250.79:6443 was refused - did you specify the right host or port?

And noticed that while running kubectl get pods -o wide --all-namespaces

kube-system   coredns-86c58d9df4-69zlx                   0/1     Evicted   0          5d23h   <none>          kmaster   <none>           <none>

kube-system   coredns-86c58d9df4-bt6lr                   0/1     Error     69         44h     <none>          kmaster   <none>           <none>

kube-system   coredns-86c58d9df4-f2wgx                   0/1     Evicted   0          45h     <none>          kmaster   <none>           <none>

kube-system   coredns-86c58d9df4-hr6lk                   0/1     Evicted   0          35m     <none>          kmaster   <none>           <none>

kube-system   coredns-86c58d9df4-jhrlt                   0/1     Evicted   0          47h     <none>          kmaster   <none>           <none>

kube-system   coredns-86c58d9df4-mgt8q                   0/1     Evicted   0          45h     <none>          kmaster   <none>           <none>

kube-system   coredns-86c58d9df4-qxgs6                   0/1     Evicted   0          6d20h   <none>          kmaster   <none>           <none>

kube-system   coredns-86c58d9df4-r2lg7                   0/1     Evicted   0          44h     <none>          kmaster   <none>           <none>

kube-system   coredns-86c58d9df4-s7kfr                   0/1     Evicted   0          6d20h   <none>          kmaster   <none>           <none>

kube-system   coredns-86c58d9df4-tr9cj                   0/1     Evicted   0          47h     <none>          kmaster   <none>           <none>

kube-system   coredns--XXXXX are in evicted state.
answered Jan 17, 2019 by anonymous

Hey you're getting the error

The connection to the server 172.30.250.79:6443 was refused - did you specify the right host or port?

because there is network issue between the hosts but that's bound to happen as your pods aren't ready yet.

Delete all evicted pods as they are unnecessary and check the pod status again. Use the following command for deleting the evicted pods.

kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod 
Also could you please register so it's easy for us and to other readers having similar issue to understand the flow of this discussion.

Related Questions In Others

0 votes
0 answers

Error: 'node-sass' version 5.0.0 is incompatible with ^4.0.0

Using the command: npx create-react-app I created ...READ MORE

May 19, 2022 in Others by Kichu
• 19,050 points
2,979 views
0 votes
1 answer

How to communicate gRPC example working with Node.js?

hi.. you can read below link, it ...READ MORE

answered Dec 2, 2019 in Others by Narendra Reddy Dalli
2,110 views
+1 vote
1 answer

what is the difference between error and stderr in Node.js?

Error is an object created by Node.js to handle ...READ MORE

answered Jul 4, 2019 in Others by sunshine
• 1,300 points
1,961 views
0 votes
1 answer

Why is MongoDB associated with Node.js?

Node.js is an open source server environment ...READ MORE

answered Jul 19, 2019 in Others by ArchanaNagur
• 2,360 points
2,916 views
0 votes
1 answer

In order to learn Node.js, I should be familiar with which other technologies ?

I appreciate your decision, its the perfect ...READ MORE

answered Jul 31, 2019 in Others by ArchanaNagur
• 2,360 points
671 views
+1 vote
1 answer
+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 5,976 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,458 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