BLOG03a: kubeadm to Join New Node

BLOG04: Joining new node

1. Get the join command directly

Run this on the control-plane (master) node:

For worker node join token

kubeadm token create --print-join-command

This prints something like:

kubeadm join <control-plane-endpoint>:6443 --token <token> \
    --discovery-token-ca-cert-hash sha256:<hash>

2. Get command for joining as a new control-plane node

If you need to join another control-plane node, run:

kubeadm init phase upload-certs --upload-certs
kubeadm token create --print-join-command --certificate-key <CERT_KEY>

Where <CERT_KEY> is output from the first command.


3. List existing tokens

If none exist, create a new token:

kubeadm does not store join commands themselves, but it does store the token metadata and CA hash in Kubernetes and on disk.

Below is exactly where you can find already-created token details and the files involved.


1. How to view existing token details

Run on the control-plane node:

List all tokens

This shows:

  • Token ID

  • Expiration

  • Usages (authentication)

  • Description

Describe a specific token

Tokens are stored as Kubernetes Secrets.

Then describe one:

This shows:

  • Token ID + Secret key

  • Allowed usages

  • Expiration

  • Creation timestamp


2. Where join token information is stored

The join tokens live inside the cluster, not as local files.

Location:

Secrets in namespace kube-system

Token structure is split into:

  • /token-id

  • /token-secret

These combine as:


3. Where certificate/CA information is stored on disk

Discovery CA hash is derived from:

You can manually compute it:


4. Where control-plane certificate key comes from

If you ran:

The certificate key is stored in memory only and not saved to disk for security reasons.

You must regenerate it if needed:


🔍 Summary

Item
Where Stored
How to View

Join token

Kubernetes Secret (kube-system)

kubeadm token list, kubectl describe secret

CA cert / discovery hash

/etc/kubernetes/pki/ca.crt

compute hash with openssl

Control-plane certificate key

Not saved

regenerate with upload-certs


Constructing Join Command Manually

Here’s how to reconstruct the exact kubeadm join command from the existing data on your cluster.

  • Control-plane endpoint

  • Join token

  • Discovery CA hash

  • (optional) certificate key for control-plane nodes


1. Get the join token

If no token exists, create one:


2. Compute the discovery-token-ca-cert-hash


3. Get the control-plane endpoint

Most clusters (kubeadm default) use the master’s API server address from kubeadm-config.

If the field is missing, you can directly use the control-plane node IP:


4. Build the join command (Worker node)

This prints:


5. Build the join command (Control-plane node)

If you want to join a new MASTER node, regenerate a cert key first:

Then:


Last updated