How to fix token is invalid in Kubernetes
The kubeadm join token used to add a node to the cluster is invalid, expired, or was malformed.
Quick fix
Fixes token is invalid
kubectl -n kube-system get secrets | grep bootstrap-token
kubectl -n kube-system describe secret bootstrap-token-XXXXX- Check token expiry on control plane
- Generate a new token if expired
- Get the CA certificate hash
- Run kubeadm join with new token
kubectl -n kube-system get secrets | grep bootstrap-tokenkubectl -n kube-system describe secret bootstrap-token-XXXXXtoken is invalid
What this error means
Kubeadm uses short-lived tokens (default 24 hours) to allow new nodes to securely join the cluster. If the token has expired, is malformed, or was already used, kubeadm join will fail. This is a security mechanism to prevent unauthorized nodes from joining.
Typical symptoms
- kubeadm join fails with "token is invalid"
- Cannot add new nodes to cluster
- Error mentions token validation failure
- Token was created more than 24 hours ago
- Token contains invalid characters or format
- Node appears in cluster but not healthy
Common causes
- Token has expired (default TTL 24 hours)
- Token was already used and consumed
- Token format is invalid (not 6.16 format)
- Token was generated with wrong cluster hash
- Typo in the join command
- Token revoked manually
How to fix "token is invalid"
List valid tokens:
kubectl -n kube-system get secrets | grep bootstrap-token
kubectl -n kube-system describe secret bootstrap-token-XXXXXOr use kubeadm:
kubeadm token listCreate a new token on the control plane:
kubeadm token create
# Or create a long-lived token
kubeadm token create --ttl 24hThis outputs the token to use in kubeadm join.
You also need the CA hash:
openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'On the worker node:
kubeadm join YOUR_CP_IP:6443 --token NEW_TOKEN --discovery-token-ca-cert-hash sha256:HASHEnsure token and hash are correct (no typos).
On the control plane:
kubectl get nodesThe new node should appear and transition to Ready status.
Advanced notes
For production clusters, consider creating tokens with longer TTL or managing them programmatically. Bootstrap tokens are stored as secrets in kube-system namespace. You can revoke a token by deleting its secret: kubectl delete secret -n kube-system bootstrap-token-XXXXX. For automated node joining, integrate with your infrastructure provisioning system.
Frequently asked questions
- What does "token is invalid" mean?
- Kubeadm uses short-lived tokens (default 24 hours) to allow new nodes to securely join the cluster. If the token has expired, is malformed, or was already used, kubeadm join will fail. This is a security mechanism to prevent unauthorized nodes from joining.
- How do I fix "token is invalid"?
- The kubeadm join token used to add a node to the cluster is invalid, expired, or was malformed.
- What causes "token is invalid"?
- Token has expired (default TTL 24 hours) Token was already used and consumed Token format is invalid (not 6.16 format)
- Is the "token is invalid" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐Kubernetes Official Documentation
- ๐Kubernetes: kubeadm token(Official Docs)
- ๐Kubernetes: Join nodes to cluster(Official Docs)