Can't find kubeadm token after initializing master

10/12/2016

When i run kubeadm init it shows a token that I should use from the other hosts to connect to this host. Where is that token stored? I'm trying to figure out more ways to automate this by adding kubeadm inside of Terraform.

Thanks for any help!

-- vallard
kubeadm
kubernetes

7 Answers

12/3/2018

Try to create new as per below command as initial token is valid only 24 hours.

kubeadm token create  --ttl=0

Here ttl=0 means, generated token will never expire.

Then join node as per below command:

kubeadm join <generated_token>

If you get any error for verifying ca hash, then join as per below:

kubeadm join <generated_token> --discovery-token-unsafe-skip-ca-verification
-- hk'
Source: StackOverflow

2/8/2018

The instruction for Kubernetes 1.9.x (and above) can be found here.

The commands I used are:

kubeadm token generate
kubeadm token create <generated-token> --print-join-command --ttl=0
-- Chris Fregly
Source: StackOverflow

6/5/2017

Run this command in the master node to get the token

kubeadm token list
-- sfgroups
Source: StackOverflow

10/13/2016

--token

By default, kubeadm init automatically generates the token used to initialise each new node. If you would like to manually specify this token, you can use the --token flag. The token must be of the format ‘<6 character string>.<16 character string>’.

you can see token value on master node using command:

cat /etc/kubernetes/pki/tokens.csv
-- pl_rock
Source: StackOverflow

3/13/2019

Best way to avoid creating new token is -

  1. kubeadm token list
  2. kubeadm token create <copied token from previous command output>** --print-join-command

you will get JOIN command to run on any physical/vitual machine to join kubernetes cluster....

-- Abhishek Jain
Source: StackOverflow

3/7/2017
kubectl -n kube-system get secret clusterinfo -o yaml | grep token-map | awk '{print $2}' | base64 -d | sed "s|{||g;s|}||g;s|:|.|g;s/\"//g;" | xargs echo
-- feisan
Source: StackOverflow

9/26/2019

Use this command : $ sudo kubeadm token list

Still, if you did not get, use following commands

$ sudo kubeadm reset
$ sudo kubeadm init 
-- Srininvasa Chary
Source: StackOverflow