Your Kubernetes cookbook for cluster management
Project description
Kitchen
Your Kubernetes cookbook for cluster management and operations.
Kitchen is a command-line tool designed to simplify Kubernetes cluster management. It provides easy-to-use commands for adding nodes, managing clusters, and performing common K8s operations.
Installation
Install using Poetry:
poetry install
Quick Start
1. Check Your Setup
kitchen setup
This checks for required tools and shows your Tailscale status.
2. Configure Your Cluster
First, set up your master node configuration:
# Initialize master node config
kitchen k8s config init --hostname master-01 \
--ip 192.168.1.10 \
--ip 100.64.1.5 \
--version 1.29 \
--cluster production
# Save cluster secrets (you'll be prompted for values)
kitchen k8s config set-secrets --cluster production
# Verify configuration
kitchen k8s config show
3. Add Worker Nodes
Step 1: Check the node
kitchen k8s node check --role worker --host user@192.168.1.100 --verbose
Step 2: Prepare the node
kitchen k8s node prepare --role worker --host user@192.168.1.100
This installs:
- Tailscale (if configured in secrets)
- CRI-O container runtime
- Kubernetes components (kubelet, kubeadm, kubectl)
Step 3: Join the node to your cluster
kitchen k8s node join --host user@192.168.1.100 --cluster production --verbose
4. View Available Commands
kitchen cookbook
This shows common recipes and usage examples.
Core Features
Cluster Configuration Management
# Initialize master node configuration
kitchen k8s config init --hostname master-01 --ip 192.168.1.10 --ip 100.64.1.5
# Save cluster secrets (join token, discovery hash, Tailscale auth key)
kitchen k8s config set-secrets --cluster my-cluster
# Show current master configuration
kitchen k8s config show
# List all configured clusters
kitchen k8s config list
# Set default cluster
kitchen k8s config set-default my-cluster
Node Management
# Run pre-flight checks on a node
kitchen k8s node check --role worker --host user@192.168.1.100 --verbose
# Prepare a node (install components)
kitchen k8s node prepare --role worker --host user@192.168.1.100 --phases tailscale,container-runtime,kube-components
# Join a worker node to the cluster
kitchen k8s node join --host user@worker-node --cluster my-cluster --verbose
# Add a node (interactive workflow - WIP)
kitchen k8s node add --master user@master-node --target user@worker-node
Available Component Phases:
tailscale- Install and configure Tailscale for secure networkingcontainer-runtime- Install CRI-O container runtimekube-components- Install kubectl, kubelet, and kubeadmapiserver-cert- Configure API server certificates (master only)
The check and prepare commands accept --phases to target specific components. If omitted, sensible defaults are used based on the node role.
Tailscale Integration
Kitchen integrates with Tailscale for secure, mesh networking between Kubernetes nodes:
Benefits:
- ๐ Secure: End-to-end encrypted mesh network
- ๐ Easy: No complex firewall rules or VPN setup
- ๐ฑ Accessible: Access your cluster from anywhere
- ๐ท๏ธ Named: Use friendly hostnames instead of IPs
How Kitchen Uses Tailscale:
- Kitchen can install and configure Tailscale on nodes during the prepare phase
- Automatically detects Tailscale IPs for kubelet node-ip configuration
- Uses Tailscale for secure API server communication
- Prefers Tailscale endpoints when joining nodes to the cluster
Configuration: Save your Tailscale auth key in cluster secrets:
kitchen k8s config set-secrets --cluster my-cluster
# You'll be prompted for the Tailscale auth key
Node Manager
# Deploy node manager to Kubernetes
kitchen node-manager deploy
# Check node manager status
kitchen node-manager status
# View node manager logs
kitchen node-manager logs --follow
# Access node manager API
kitchen node-manager api --port 8000
Utility Commands
# Run any command
kitchen run kubectl get pods
# Show Kitchen version
kitchen version
# View the cookbook
kitchen cookbook
Prerequisites
Kitchen requires these tools to be installed:
Required (for local machine):
kubectl- Kubernetes command-line tool (for cluster interaction)kubeadm- Kubernetes cluster management (if setting up locally)docker- Container runtime (for local development, not required for remote node setup)
Recommended:
tailscale- Secure mesh networking (highly recommended)ssh- Remote access to nodessshpass- For password-based SSH automation
Note: Kitchen automatically installs CRI-O (container runtime) and Kubernetes components on remote nodes during the prepare phase. You don't need to pre-install these on worker nodes.
Run kitchen setup to check your installation and see Tailscale status.
Development
Setup Development Environment
# Install dependencies
poetry install
# Run CLI in development
poetry run kitchen --help
# Run with verbose output
poetry run kitchen --verbose k8s config show
UI
Build the Vite UI from the repository root with:
npm install npm run build
Then build the node-manager image; the Docker build expects dist/kitchen-ui to
exist and will copy it into the image so the UI can be served from /ui.
Project Structure
src/kitchen/
โโโ main.py # Main CLI entry point
โโโ ssh.py # SSH session management
โโโ config/ # Configuration management
โโโ k8s/ # Kubernetes operations
โ โโโ main.py # K8s CLI commands
โ โโโ handlers/ # Component handlers (Tailscale, CRI-O, etc.)
โ โโโ nodes/ # Pre-flight checks
โ โโโ master.py # Master node operations
โ โโโ worker.py # Worker node operations
โโโ node_manager/ # Node monitoring service
โโโ api/ # FastAPI endpoints
โโโ cli.py # Node manager CLI
โโโ manifests/ # Kubernetes manifests
Running Tests
# Run all tests
poetry run pytest
# Run with coverage
poetry run pytest --cov=kitchen
Roadmap
- โ Node pre-flight checks (validate requirements before setup)
- โ Node preparation (automated CRI-O and Kubernetes component installation)
- โ Worker node joining with Tailscale support
- โ Cluster configuration management (multi-cluster support)
- โ Node manager with FastAPI and connectivity tracking
- โ Tailscale integration (automated installation and configuration)
- โ CRI-O container runtime support
- ๐ง Complete node addition workflow (interactive end-to-end)
- ๐ง Master node initialization
- ๐ง Node removal and cleanup
- ๐ง Cluster backup and restore
Troubleshooting
Common Issues
SSH Connection Issues
- Ensure SSH key permissions are correct:
chmod 600 ~/.ssh/id_rsa - Test SSH connection manually:
ssh user@host - Use
--verboseflag for detailed connection logs
Node Join Failures
- Verify master config is set:
kitchen k8s config show - Check cluster secrets are saved:
kitchen k8s config show-secrets - Ensure all phases are prepared:
kitchen k8s node check --role worker --host user@node - Review join logs with
--verboseflag
Tailscale Issues
- Verify Tailscale is running:
tailscale status - Check auth key is set in secrets:
kitchen k8s config show-secrets - Manually test Tailscale connectivity:
ping 100.64.x.x
Container Runtime Issues
- Check CRI-O status:
systemctl status crio - View CRI-O logs:
journalctl -u crio -f - Verify container runtime socket:
crictl info
Getting Help
- Run any command with
--helpfor detailed usage - Use
--verboseflag for debugging - Check the cookbook:
kitchen cookbook - Review command history in
.github/history/for development context
Contributing
Kitchen is designed to be your personal Kubernetes cookbook. Feel free to extend it with your own recipes and automation!
Development Guidelines:
- Follow existing code structure and patterns
- Add type hints to all functions
- Keep line length to 120 characters (use
# fmt: skipfor long strings) - Use named constants instead of magic numbers
- Write comprehensive error messages with actionable suggestions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file k8s_kitchen-0.2.0.tar.gz.
File metadata
- Download URL: k8s_kitchen-0.2.0.tar.gz
- Upload date:
- Size: 57.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.3 Linux/6.14.0-33-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
936f21932f63284ba10964dd72c19dad62e3a5bd2cc3d72d5d0e2a2cb277a38f
|
|
| MD5 |
643fffbf8f193eefbf9eff3a47a0d80d
|
|
| BLAKE2b-256 |
7eb9c313aed2cce11c61e1e8a99c8bc33c3226f45c43bb1ad2f9ac37a27e4f6d
|
File details
Details for the file k8s_kitchen-0.2.0-py3-none-any.whl.
File metadata
- Download URL: k8s_kitchen-0.2.0-py3-none-any.whl
- Upload date:
- Size: 71.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.3 Linux/6.14.0-33-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5b0cd7ab9adf5a58e6f941eed017f8c0233657585c3ea52b88c1544cf0cb3cb
|
|
| MD5 |
05f028d84fdc2c6e8235223885483f3e
|
|
| BLAKE2b-256 |
f6c48ee2ecbe8542d70f768ae0af045c16bcf7d9dc7b2f1b399e9548360f076d
|