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 in Others by vishal
732 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.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Hi Any update?
answered Jan 16 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 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 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

How to communicate gRPC example working with Node.js?

Hi Guys, I am working as a Node.js ...READ MORE

Dec 5, 2018 in Others by camillelola
• 140 points
190 views
0 votes
1 answer

Using unserialize in PHP throws the same error repeatedly

I googled 'Node no longer exists', and ...READ MORE

answered Nov 14, 2018 in Others by DataKing99
• 8,100 points
82 views
0 votes
1 answer

Parsing a string with GetOpt::Long::GetOptions

Hey, have a look at the section ...READ MORE

answered Nov 15, 2018 in Others by nirvana
• 3,060 points
76 views
0 votes
1 answer

Using SharePoint designer with SharePoint Online ?

Sharepoint gives you a trial account for ...READ MORE

answered Feb 12 in Others by Priyaj
• 56,140 points
24 views
0 votes
1 answer

Execute a shell script with php

One of the possible reason for this ...READ MORE

answered Feb 23 in Others by Omkar
• 66,910 points
26 views
0 votes
1 answer

Need help with Perl Installation

Hi, Perl installation steps are as follows: Go ...READ MORE

answered Feb 28 in Others by Abha
• 9,330 points
27 views
0 votes
1 answer
+3 votes
1 answer
+13 votes
2 answers

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.