A lightweight infrastructure tool that automatically maintains fresh join tokens for Kubernetes cluster nodes. This tool runs as a scheduled systemd service on control plane nodes, generating new kubeadm join tokens every 8 hours and storing them securely in HashiCorp Vault.
The primary use case is to automate the bootstrapping of newly launched cluster nodes in GitOps environments. New nodes can autonomously obtain fresh join tokens from Vault using bootstrap credentials, enabling fully automated cluster expansion without manual token management.
- Automated Token Rotation: Generates new join tokens every 8 hours for enhanced security
- Vault Integration: Securely stores tokens in HashiCorp Vault KV store
- Systemd Native: Proper service lifecycle management with timer-based scheduling
- GitOps Ready: Designed for infrastructure-as-code and configuration management
- Single Purpose: Focused tool that does one thing well
Download the latest .deb
package from GitHub Releases:
# Download and install
wget https://github.com/your-org/manage-join-token/releases/download/v1.0.0/manage-join-token_1.0.0_all.deb
sudo dpkg -i manage-join-token_1.0.0_all.deb
# Copy the script
sudo cp manage-join-token /usr/bin/manage-join-token
sudo chmod +x /usr/bin/manage-join-token
# Install systemd units
sudo cp systemd/* /etc/systemd/system/
sudo systemctl daemon-reload
Configure the service with your Vault settings:
sudo systemctl edit manage-join-token.service
Add the following configuration:
[Service]
Environment=VAULT_SECRET_PATH=k8s-clusters/your-cluster-name
Environment=VAULT_ADDR=https://vault.yourdomain.com
EnvironmentFile=/etc/kubernetes/vault-token
Create the Vault token file:
# Option 1: Static token file
echo "your-vault-token" | sudo tee /etc/kubernetes/vault-token
# Option 2: Use Vault agent for token renewal (recommended)
# Configure vault-agent to maintain the token file
# Enable the timer for automatic execution
sudo systemctl enable manage-join-token.timer
sudo systemctl start manage-join-token.timer
# Check service status
sudo systemctl status manage-join-token.timer
Once configured, the service runs automatically every 8 hours via systemd timer. No manual intervention required.
For testing or immediate token generation:
# Run once manually
sudo systemctl start manage-join-token.service
# Check logs
sudo journalctl -u manage-join-token.service -f
New nodes can retrieve the join token from Vault:
# Example: Retrieve join token for cluster bootstrapping
vault kv get -field=join_command k8s-clusters/your-cluster-name
kubeadm
binary in PATH- Cluster admin permissions for token generation
- Root access for systemd service execution
- HashiCorp Vault server accessible from control plane
- Vault CLI installed and configured
- Valid authentication token with write permissions to specified KV path
- KV secrets engine enabled
# Check timer status
sudo systemctl status manage-join-token.timer
# View recent executions
sudo journalctl -u manage-join-token.service --since "24 hours ago"
# Check next scheduled run
sudo systemctl list-timers manage-join-token.timer
# Verify token exists in Vault
vault kv get k8s-clusters/your-cluster-name
# Test token validity (kubeadm will validate format)
kubeadm token list
- Service runs with root privileges (required for kubeadm operations)
- Vault tokens should use least-privilege access (write to specific KV path only)
- Join tokens have 24-hour default expiration (kubeadm default)
- Consider using Vault agent for token renewal instead of static tokens
- Deploy only on trusted control plane nodes
Service fails to start:
# Check configuration
sudo systemctl status manage-join-token.service
sudo journalctl -u manage-join-token.service -n 20
Vault authentication errors:
# Test Vault connectivity
vault auth -method=token
vault kv put test/path key=value
Missing kubeadm:
# Ensure kubeadm is installed and in PATH
which kubeadm
kubeadm version
# View detailed logs
sudo journalctl -u manage-join-token.service -f
# Check timer execution history
sudo journalctl -u manage-join-token.timer
# Build Debian package
dpkg-buildpackage
# Run tests
./test-script.sh # If test suite exists
- Fork the repository
- Create a feature branch
- Make changes with appropriate tests
- Submit a pull request
See CONTRIBUTING.md for detailed guidelines.
[Add appropriate license information]
- flux-golder - Main GitOps infrastructure management
- ansible-playbooks - Infrastructure automation
- k8s-node-packer - Automated node image builds