Skip to content

Commit 34bd885

Browse files
committed
Add guide for getting token and discovery-token-ca-cert-hash
1 parent 995453c commit 34bd885

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

content/en/docs/setup/independent/create-cluster-kubeadm.md

+27
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,33 @@ The nodes are where your workloads (containers and pods, etc) run. To add new no
382382
kubeadm join --token <token> <master-ip>:<master-port> --discovery-token-ca-cert-hash sha256:<hash>
383383
```
384384

385+
If you do not have the token, you can get it by running the following command on the master node:
386+
387+
``` bash
388+
# kubeadm token list
389+
TOKEN TTL EXPIRES USAGES DESCRIPTION EXTRA GROUPS
390+
8ewj1p.9r9hcjoqgajrj4gi 23h 2018-06-12T02:51:28Z authentication, The default bootstrap system:
391+
signing token generated by bootstrappers:
392+
'kubeadm init'. kubeadm:
393+
default-node-token
394+
```
395+
396+
By default, tokens expire after 24 hours. If you are joining a node to the cluster after the current token has expired,
397+
you can create a new token by running the following command on the master node:
398+
399+
``` bash
400+
# kubeadm token create
401+
5didvk.d09sbcov8ph2amjw
402+
```
403+
404+
If you don't have the value of `--discovery-token-ca-cert-hash`, you can get it by running the following command chain on the master node:
405+
406+
``` bash
407+
# openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | \
408+
openssl dgst -sha256 -hex | sed 's/^.* //'
409+
8cb2de97839780a412b93877f8507ad6c94f73add17d5d7058e91741c9d5ec78
410+
```
411+
385412
{{< note >}}
386413
**Note:** To specify an IPv6 tuple for `<master-ip>:<master-port>`, IPv6 address must be enclosed in square brackets, for example: `[fd00::101]:2073`.
387414
{{< /note >}}

0 commit comments

Comments
 (0)